From e6160912497036d58c9e52debb4f694d3c39f78c Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Tue, 15 Jul 2025 21:47:50 +0700 Subject: [PATCH] cmd/cli: ignore empty positional argument for start command The validation was added during v1.4.0 release, but causing one-liner install failed unexpectedly. --- cmd/cli/commands.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/cli/commands.go b/cmd/cli/commands.go index 048212a..2b43320 100644 --- a/cmd/cli/commands.go +++ b/cmd/cli/commands.go @@ -13,6 +13,7 @@ import ( "os/exec" "path/filepath" "runtime" + "slices" "sort" "strconv" "strings" @@ -206,6 +207,9 @@ func initStartCmd() *cobra.Command { NOTE: running "ctrld start" without any arguments will start already installed ctrld service.`, Args: func(cmd *cobra.Command, args []string) error { + args = slices.DeleteFunc(args, func(arg string) bool { + return arg == "" + }) if len(args) > 0 { return fmt.Errorf("'ctrld start' doesn't accept positional arguments\n" + "Use flags instead (e.g. --cd, --iface) or see 'ctrld start --help' for all options") @@ -566,6 +570,9 @@ NOTE: running "ctrld start" without any arguments will start already installed c NOTE: running "ctrld start" without any arguments will start already installed ctrld service.`, Args: func(cmd *cobra.Command, args []string) error { + args = slices.DeleteFunc(args, func(arg string) bool { + return arg == "" + }) if len(args) > 0 { return fmt.Errorf("'ctrld start' doesn't accept positional arguments\n" + "Use flags instead (e.g. --cd, --iface) or see 'ctrld start --help' for all options")