Simplify two if

update pull request

update pull request

update pull request

update pull request

update pull request

update pull request
This commit is contained in:
aaa 2019-03-21 10:58:25 -04:00
parent 997d5182d0
commit 5c8e550a29

View File

@ -117,10 +117,9 @@ func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command {
// RunCompletion checks given arguments and executes command // RunCompletion checks given arguments and executes command
func RunCompletion(out io.Writer, boilerPlate string, cmd *cobra.Command, args []string) error { func RunCompletion(out io.Writer, boilerPlate string, cmd *cobra.Command, args []string) error {
if len(args) == 0 { if length := len(args); length == 0 {
return errors.New("shell not specified") return errors.New("shell not specified")
} } else if length > 1 {
if len(args) > 1 {
return errors.New("too many arguments. expected only the shell type") return errors.New("too many arguments. expected only the shell type")
} }
run, found := completionShells[args[0]] run, found := completionShells[args[0]]