Skip to content

Commit

Permalink
main: Bugfix: Print all command line help text to stderr, not stdout (#…
Browse files Browse the repository at this point in the history
…393)

Previously some was printed to stderr, some was printed to stdout.
  • Loading branch information
fxkr authored and tsenart committed Apr 28, 2019
1 parent 53e27da commit 579df76
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.go
Expand Up @@ -26,8 +26,8 @@ func main() {
version := fs.Bool("version", false, "Print version and exit")

fs.Usage = func() {
fmt.Println("Usage: vegeta [global flags] <command> [command flags]")
fmt.Printf("\nglobal flags:\n")
fmt.Fprintln(fs.Output(), "Usage: vegeta [global flags] <command> [command flags]")
fmt.Fprintf(fs.Output(), "\nglobal flags:\n")
fs.PrintDefaults()

names := make([]string, 0, len(commands))
Expand All @@ -38,12 +38,13 @@ func main() {
sort.Strings(names)
for _, name := range names {
if cmd := commands[name]; cmd.fs != nil {
fmt.Printf("\n%s command:\n", name)
fmt.Fprintf(fs.Output(),"\n%s command:\n", name)
cmd.fs.SetOutput(fs.Output())
cmd.fs.PrintDefaults()
}
}

fmt.Println(examples)
fmt.Fprintln(fs.Output(), examples)
}

fs.Parse(os.Args[1:])
Expand Down

0 comments on commit 579df76

Please sign in to comment.