commands/cli: Error if no subcommand matched

This commit is contained in:
Matt Bell 2014-10-31 14:10:04 -07:00 committed by Juan Batiz-Benet
parent 83b2ba00e9
commit 30e968754e

View File

@ -1,6 +1,7 @@
package cli
import (
"errors"
"fmt"
"strings"
@ -30,6 +31,10 @@ func Parse(input []string, roots ...*cmds.Command) (cmds.Request, *cmds.Command,
}
}
if maxLength == 0 {
return nil, nil, errors.New("Not a valid subcommand")
}
// TODO: figure out how to know when to read given file(s) as an input stream
// (instead of filename arg string)