Make sure to handle errors when generating completions

This commit is contained in:
Mislav Marohnić 2020-02-19 15:39:33 +01:00
parent 48ffd5aa00
commit 6424e8c92a

View file

@ -33,14 +33,13 @@ When installing with Homebrew, see https://docs.brew.sh/Shell-Completion
switch shellType {
case "bash":
RootCmd.GenBashCompletion(cmd.OutOrStdout())
return RootCmd.GenBashCompletion(cmd.OutOrStdout())
case "zsh":
RootCmd.GenZshCompletion(cmd.OutOrStdout())
return RootCmd.GenZshCompletion(cmd.OutOrStdout())
case "fish":
cobrafish.GenCompletion(RootCmd, cmd.OutOrStdout())
return cobrafish.GenCompletion(RootCmd, cmd.OutOrStdout())
default:
return fmt.Errorf("unsupported shell type %q", shellType)
}
return nil
},
}