-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Checklist
- Are you running the latest v3 release? The list of releases is here.
- Did you check the manual for your release? The v3 manual is here. -- This link is a 404
- Did you perform a search about this feature? Here's the GitHub guide about searching.
What problem does this solve?
In 3.0.0-alpha9, default text is always printed, irrespective of whether the field is required, etc.
This means that required numeric flags have help text that prints a default value of 0, for example. The current API supports bringing your own DefaultText, but if you set it to "", it doesn't get applied. See relevant code here and here.
Arguably this is a bug for implicit zero-valued default values. Certainly this is a bug for required flags with an implicit zero-valued default. Regardless of its status as a bug or expected behavior, it would be nice to be able to opt out of showing default text altogether on a flag-by-flag basis.
Solution description
I'd like for an OmitDefaultText boolean field to be added to flag base, or a similarly turn-key solution.
Describe alternatives you've considered
I think you could also make the DefaultText field a *string, and use the empty string to indicate that default text shouldn't be printed, and I think that would also be fine. I could also imagine at the flag level being able to specify the help template for that flag only, which would be slightly more cumbersome.