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

The usage string of custom flags (defaults section) can change depending on the presence of a value #245

Open
avoskresensky opened this issue Feb 12, 2020 · 0 comments

Comments

@avoskresensky
Copy link

The defaults section of the usage string is currently composed by analyzing the return of the String() function of the corresponding Value object. As a result, the usage string generated when the Value is empty can differ from the one generated after the Value is set.

The following two invocations are going to produce different results.
(--customFlag has no default)
./program --help
./program --customFlag=10 --help

This is a real nuisance for us as we use custom flags extensively.
Whenever a user requests --help for a subcommand or makes a mistake in one of the flags, the usage info that they get ends up having some bogus defaults.

I've already submitted a pull request with a test case that demonstrates the problem.
#243

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

No branches or pull requests

1 participant