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

pkg/cfg: print help only when requested, and print it on stdout #1396

Merged
merged 1 commit into from
Dec 13, 2019
Merged

pkg/cfg: print help only when requested, and print it on stdout #1396

merged 1 commit into from
Dec 13, 2019

Conversation

pstibrany
Copy link
Member

What this PR does / why we need it:

-h/-help now prints available parameters and their descriptions to stdout. This makes it easier to grep/less them without extra stderr->stdout redirects.

When invalid parameter or value is provided, error is printed to stderr, together with message indicating how to get list of all parameters. For example:

flag provided but not defined: -helpasdjh
Run with -help to get list of available parameters

or

invalid value "12837128937p" for flag -validation.reject-old-samples.max-age: parse error
Run with -help to get list of available parameters

Which issue(s) this PR fixes:
Fixes #1193

When invalid parameter or value is provided, error is printed to stderr,
together with message indicating how to get list of all parameters.

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

Lgtm

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.

Send --help output to stdout
2 participants