@@ -267,10 +267,13 @@ var usageWantsArgRe = regexp.MustCompile(`<.*>`)
267
267
// output for a given command.
268
268
func helpFn () clibase.HandlerFunc {
269
269
return func (inv * clibase.Invocation )error {
270
- // We buffer writes to stderr because the newlineLimiter writes one
270
+ // We use stdout for help and not stderr since there's no straightforward
271
+ // way to distinguish between a user error and a help request.
272
+ //
273
+ // We buffer writes to stdout because the newlineLimiter writes one
271
274
// rune at a time.
272
- stderrBuf := bufio .NewWriter (inv .Stderr )
273
- out := newlineLimiter {w :stderrBuf ,limit :2 }
275
+ outBuf := bufio .NewWriter (inv .Stdout )
276
+ out := newlineLimiter {w :outBuf ,limit :2 }
274
277
tabwriter := tabwriter .NewWriter (& out ,0 ,0 ,2 ,' ' ,0 )
275
278
err := usageTemplate .Execute (tabwriter ,inv .Command )
276
279
if err != nil {
@@ -280,7 +283,7 @@ func helpFn() clibase.HandlerFunc {
280
283
if err != nil {
281
284
return err
282
285
}
283
- err = stderrBuf .Flush ()
286
+ err = outBuf .Flush ()
284
287
if err != nil {
285
288
return err
286
289
}