commands/cli: Error if no subcommand matched
Matt Bell committed
Oct 31, 2014 at 14:10 UTC
30e968754e31fe2ce9532886dc1b8b7dcf140230
1 file changed
+5
commands/cli/parse.go
+5
@@ -1,6 +1,7 @@
1
package cli
2
3
import (
4
+ "errors"
5
"fmt"
6
"strings"
7
@@ -30,6 +31,10 @@ func Parse(input []string, roots ...*cmds.Command) (cmds.Request, *cmds.Command,
31
}
32
}
33
34
+ if maxLength == 0 {
35
+ return nil, nil, errors.New("Not a valid subcommand")
36
+ }
37
+
38
// TODO: figure out how to know when to read given file(s) as an input stream
39
// (instead of filename arg string)
40