From 0d9d2d46f3099574b6d524c3d8834dd592a80fb3 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Mon, 23 Dec 2019 13:38:24 -0500 Subject: [PATCH] Revert change so help is printed on stdout again (#1004) Fixes #1002 For backwards compatibility reasons, and to follow the need of https://github.com/kubernetes/kubernetes/pull/26077#issuecomment-230818900 the help message should be printed on stdout. Signed-off-by: Marc Khouzam --- command.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/command.go b/command.go index 42e500d..ab3cf69 100644 --- a/command.go +++ b/command.go @@ -372,7 +372,9 @@ func (c *Command) HelpFunc() func(*Command, []string) { } return func(c *Command, a []string) { c.mergePersistentFlags() - err := tmpl(c.OutOrStderr(), c.HelpTemplate(), c) + // The help should be sent to stdout + // See https://github.com/spf13/cobra/issues/1002 + err := tmpl(c.OutOrStdout(), c.HelpTemplate(), c) if err != nil { c.Println(err) }