Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print usage on stdout, and only when asked with -help. #2691

Merged
merged 3 commits into from
Jun 4, 2020
Merged

Print usage on stdout, and only when asked with -help. #2691

merged 3 commits into from
Jun 4, 2020

Conversation

pstibrany
Copy link
Contributor

@pstibrany pstibrany commented Jun 4, 2020

This is small quality-of-life improvement to improve handling invalid flags and -help.

Invalid flags no longer trigger printing of all available flags (but is still printed to stderr):

$ ./cortex -asdasdsa > /dev/null
flag provided but not defined: -asdasdsa
Run with -help to get list of available parameters

Available flags are printed to stdout, so that extra redirection of stderr to stdout is not required to use with grep or less or other tools.

$ ./cortex -help | grep compactor.ring.consul
  -compactor.ring.consul.acl-token string
  -compactor.ring.consul.client-timeout duration
  -compactor.ring.consul.consistent-reads
  -compactor.ring.consul.hostname string
  -compactor.ring.consul.watch-burst-size int
  -compactor.ring.consul.watch-rate-limit float

Inspired by recent Slack discussion and similar change in Loki (grafana/loki#1396).

Checklist

  • Tests updated
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
pstibrany added 2 commits June 4, 2020 13:48
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Looks a nice addition. I would have found it useful in few occasions in the past.

@pstibrany pstibrany merged commit e8f3a6a into cortexproject:master Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants