From 6424e8c92ae9a11e0a0afa240f0e2011f4c151cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 19 Feb 2020 15:39:33 +0100 Subject: [PATCH] Make sure to handle errors when generating completions --- command/completion.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/command/completion.go b/command/completion.go index ee0e8978a..d225082ef 100644 --- a/command/completion.go +++ b/command/completion.go @@ -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 }, }