From c35cdb36848a09bc6901d955ad0dcd1057b2cca7 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 11 Jan 2022 15:43:24 +0300 Subject: [PATCH] [#1041] autocomplete: fetch output stream from provided command Signed-off-by: Evgenii Stratonikov --- pkg/util/autocomplete/autocomplete.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/util/autocomplete/autocomplete.go b/pkg/util/autocomplete/autocomplete.go index 7f0e0c1bb..1343c30a3 100644 --- a/pkg/util/autocomplete/autocomplete.go +++ b/pkg/util/autocomplete/autocomplete.go @@ -2,7 +2,6 @@ package autocomplete import ( "fmt" - "os" "github.com/spf13/cobra" ) @@ -48,13 +47,13 @@ func Command(name string) *cobra.Command { Run: func(cmd *cobra.Command, args []string) { switch args[0] { case "bash": - _ = cmd.Root().GenBashCompletion(os.Stdout) + _ = cmd.Root().GenBashCompletion(cmd.OutOrStdout()) case "zsh": - _ = cmd.Root().GenZshCompletion(os.Stdout) + _ = cmd.Root().GenZshCompletion(cmd.OutOrStdout()) case "fish": - _ = cmd.Root().GenFishCompletion(os.Stdout, true) + _ = cmd.Root().GenFishCompletion(cmd.OutOrStdout(), true) case "powershell": - _ = cmd.Root().GenPowerShellCompletion(os.Stdout) + _ = cmd.Root().GenPowerShellCompletion(cmd.OutOrStdout()) } }, }