From aa2cd0c3722654be235eb82f87c84d65bd817309 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sun, 22 Dec 2019 12:06:01 -0500 Subject: [PATCH] Revert change so help is printed on stdout again 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 42e500de5..ab3cf69a9 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) }