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

Allow omission of default text in help text #1925

Open
3 tasks done
drewfead opened this issue Jun 12, 2024 · 0 comments
Open
3 tasks done

Allow omission of default text in help text #1925

drewfead opened this issue Jun 12, 2024 · 0 comments
Labels
area/v3 relates to / is being considered for v3 status/triage maintainers still need to look into this

Comments

@drewfead
Copy link

drewfead commented Jun 12, 2024

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.

@drewfead drewfead added area/v3 relates to / is being considered for v3 status/triage maintainers still need to look into this labels Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/v3 relates to / is being considered for v3 status/triage maintainers still need to look into this
Projects
None yet
Development

No branches or pull requests

1 participant