KEMBAR78
Update freno help message handling by gtowey · Pull Request #113 · github/freno · GitHub
Skip to content

Conversation

@gtowey
Copy link
Contributor

@gtowey gtowey commented Dec 16, 2019

Currently the default behavior for running freno -help is to emit a panic. This overrides the default behavior of the flag package and makes it so there's no way to see the list of program options.

There is a program-specific usage message which is emitted when there are no arguments. There's no reason to have separate behavior for this usage message and -help output, so this PR combines emitting program options with the custom usage message and gives this behavior to the 'no options' default program behavior and the '-help' argument. This ensures that default expected behavior matched the actual program behavior

Now when you run freno -help you'll see:

Usage: freno [OPTIONS]
  To run the freno service, execute:
    freno --http

  freno is a free and open source software.
    Please see https://github.com/github/freno/blob/master/README.md#license for license.
    Sources and binaries are found on https://github.com/github/freno/releases.
    Sources are also available by cloning https://github.com/github/freno.

  Issues can be sumbitted on https://github.com/github/freno/issues
  Please see https://github.com/github/freno/blob/master/README.md#contributing for contributions

  Authored by GitHub engineering

  OPTIONS:
  -config string
    	config file name
  -debug
    	debug mode (very verbose)
  -force-leadership
    	Make this node consider itself a leader no matter what consensus logic says
  -help
    	show the help
  -http
    	spawn the HTTP API server
  -http-port int
    	HTTP listen port; overrides config's ListenPort
  -quiet
    	quiet
  -raft-bind string
    	Raft bind address (example: '127.0.0.1:10008'). Overrides config's RaftBind
  -raft-datadir string
    	Data directory for raft backend db; overrides config's RaftDataDir
  -raft-nodes string
    	Comma separated (e.g. 'host:port[,host:port]') list of raft nodes. Overrides config's RaftNodes
  -stack
    	add stack trace upon error
  -verbose
    	verbose

Currently the default behavior for running 'freno -help' is to emit a panic.  This overrides the default behavior of the flag package and makes it so there's no way to see the list of program options.  There is a program-specific usage message which is emitted when there are no arguments.  There's no reason to have separate behavior for this usage message and -help output, so this PR combines emiting program options with the custom usage message and gives this behavior to the 'no options' default program behavior and the '-help' argument.  This ensures that default expected behavior matched the actual program behavior
@gtowey gtowey requested a review from shlomi-noach December 16, 2019 20:13
Copy link

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the late review 🚀

@timvaillancourt timvaillancourt self-requested a review July 23, 2020 10:38
@timvaillancourt
Copy link
Contributor

LGTM 👍

@timvaillancourt timvaillancourt merged commit 48a765a into master Aug 7, 2020
@timvaillancourt timvaillancourt deleted the gtowey-freno-help branch August 7, 2020 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants