Merge pull request #5710 from cli/completion-output-fix

Fix Cobra completion output going to stdout
This commit is contained in:
Mislav Marohnić 2022-05-25 15:43:02 +02:00 committed by GitHub
commit 0bd36fe03a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,8 +57,8 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) *cobra.Command {
},
}
cmd.SetOut(f.IOStreams.ErrOut) // command usage summary and deprecation warnings
cmd.SetErr(f.IOStreams.ErrOut) // error messages
// cmd.SetOut(f.IOStreams.Out) // can't use due to https://github.com/spf13/cobra/issues/1708
// cmd.SetErr(f.IOStreams.ErrOut) // just let it default to os.Stderr instead
cmd.Flags().Bool("version", false, "Show gh version")
cmd.PersistentFlags().Bool("help", false, "Show help for command")