diff --git a/commands/cli/parse.go b/commands/cli/parse.go index a58298f17446366217d22f12d6815dce0409319a..23a7e1976f89fc11c6641ad1b65c51cdc113b9c4 100644 --- a/commands/cli/parse.go +++ b/commands/cli/parse.go @@ -10,11 +10,7 @@ import ( // Parse parses the input commandline string (cmd, flags, and args). // returns the corresponding command Request object. func Parse(input []string, root *commands.Command) (*commands.Request, error) { - path, input, err := parsePath(input, root) - if err != nil { - return nil, err - } - + path, input := parsePath(input, root) opts, args, err := parseOptions(input) if err != nil { return nil, err @@ -24,7 +20,7 @@ func Parse(input []string, root *commands.Command) (*commands.Request, error) { } // parsePath gets the command path from the command line input -func parsePath(input []string, root *commands.Command) ([]string, []string, error) { +func parsePath(input []string, root *commands.Command) ([]string, []string) { cmd := root i := 0 @@ -41,7 +37,7 @@ func parsePath(input []string, root *commands.Command) ([]string, []string, erro i++ } - return input[:i], input[i:], nil + return input[:i], input[i:] } // parseOptions parses the raw string values of the given options diff --git a/commands/cli/parse_test.go b/commands/cli/parse_test.go index caa82c1d0a4efa0117fdacf3da4cba94b1a8effb..dffc4b1430c47aacc5bd6e9ab27821a69d360311 100644 --- a/commands/cli/parse_test.go +++ b/commands/cli/parse_test.go @@ -35,10 +35,7 @@ func TestOptionParsing(t *testing.T) { t.Error("Should have failed (duplicate option name)") } - path, args, err := parsePath([]string{"test", "beep", "boop"}, cmd) - if err != nil { - t.Error("Should have passed") - } + path, args := parsePath([]string{"test", "beep", "boop"}, cmd) if len(path) != 1 || path[0] != "test" { t.Error("Returned path was defferent than expected: %v", path) }