Skip to content

Commit 5c8e550

Browse files
committed
Simplify two if
update pull request update pull request update pull request update pull request update pull request update pull request
1 parent 997d518 commit 5c8e550

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cmd/kubeadm/app/cmd/completion.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,9 @@ func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command {
117117

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

0 commit comments

Comments
 (0)