Merge pull request #75931 from xichengliudui/Simplify-two-if

Simplify two if (remove redundant code)
k3s-v1.15.3
Kubernetes Prow Robot 2019-04-01 15:49:21 -07:00 committed by GitHub
commit dd96b15e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

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