Fixed error handling

This commit is contained in:
Mike Farah 2020-06-11 18:30:45 +10:00
parent de8dcff803
commit 6777d639c0

View File

@ -25,17 +25,13 @@ func createBashCompletionCmd(rootCmd *cobra.Command) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
switch shellVariant { switch shellVariant {
case "bash", "": case "bash", "":
rootCmd.GenBashCompletion(os.Stdout) return rootCmd.GenBashCompletion(os.Stdout)
return nil
case "zsh": case "zsh":
rootCmd.GenZshCompletion(os.Stdout) return rootCmd.GenZshCompletion(os.Stdout)
return nil
case "fish": case "fish":
rootCmd.GenFishCompletion(os.Stdout, true) return rootCmd.GenFishCompletion(os.Stdout, true)
return nil
case "powershell": case "powershell":
rootCmd.GenPowerShellCompletion(os.Stdout) return rootCmd.GenPowerShellCompletion(os.Stdout)
return nil
default: default:
return fmt.Errorf("Unknown variant %v", shellVariant) return fmt.Errorf("Unknown variant %v", shellVariant)
} }