mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-16 13:17:19 +02:00
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.
This commit is contained in:
committed by
Cuong Manh Le
parent
7552f1ca7c
commit
02032c8f9f
@@ -13,6 +13,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -204,6 +205,9 @@ func initStartCmd() *cobra.Command {
|
|||||||
|
|
||||||
NOTE: running "ctrld start" without any arguments will start already installed ctrld service.`,
|
NOTE: running "ctrld start" without any arguments will start already installed ctrld service.`,
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
|
args = slices.DeleteFunc(args, func(arg string) bool {
|
||||||
|
return arg == ""
|
||||||
|
})
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
return fmt.Errorf("'ctrld start' doesn't accept positional arguments\n" +
|
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")
|
"Use flags instead (e.g. --cd, --iface) or see 'ctrld start --help' for all options")
|
||||||
@@ -520,6 +524,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.`,
|
NOTE: running "ctrld start" without any arguments will start already installed ctrld service.`,
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
|
args = slices.DeleteFunc(args, func(arg string) bool {
|
||||||
|
return arg == ""
|
||||||
|
})
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
return fmt.Errorf("'ctrld start' doesn't accept positional arguments\n" +
|
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")
|
"Use flags instead (e.g. --cd, --iface) or see 'ctrld start --help' for all options")
|
||||||
|
|||||||
Reference in New Issue
Block a user