From 37b230090722112de5a102598a75cad2c383cb0e Mon Sep 17 00:00:00 2001 From: Miguel de la Cruz Date: Mon, 5 Oct 2020 11:59:24 +0200 Subject: [PATCH] Use cmd's out fd instead of os' --- cmd/completion.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/completion.go b/cmd/completion.go index 936546f..dd2365d 100644 --- a/cmd/completion.go +++ b/cmd/completion.go @@ -2,7 +2,6 @@ package cmd import ( "fmt" - "os" "github.com/spf13/cobra" ) @@ -48,13 +47,13 @@ To configure your zsh shell to load completions for each session, add the above } func bashCompletionCmdF(cmd *cobra.Command, args []string) { - if err := cmd.Root().GenBashCompletion(os.Stdout); err != nil { + if err := cmd.Root().GenBashCompletion(cmd.OutOrStdout()); err != nil { ErrorAndExit(cmd, fmt.Errorf("unable to generate completions: %w", err)) } } func zshCompletionCmdF(cmd *cobra.Command, args []string) { - if err := cmd.Root().GenZshCompletion(os.Stdout); err != nil { + if err := cmd.Root().GenZshCompletion(cmd.OutOrStdout()); err != nil { ErrorAndExit(cmd, fmt.Errorf("unable to generate completions: %w", err)) } }