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

fix(bool-with-inverse-flag): fix string printing of bool with inverse flag to properly show inverse prefix #1966

Merged
merged 8 commits into from
Aug 17, 2024

Conversation

mahadzaryab1
Copy link
Contributor

@mahadzaryab1 mahadzaryab1 commented Aug 17, 2024

What type of PR is this?

  • bug

What this PR does / why we need it:

  • The current usage output of the BoolWithInverseFlag was confusing as it was outputting the same description for both the positive and negative flags. This PR makes the usage a bit more clear by only printing out one usage description and printing the inverse prefix in brackets.

Which issue(s) this PR fixes:

This PR fixes #1883.

Special notes for your reviewer:

  • I tried to make the fix using the existing FlagStringer and manipulating its output to match what we want. Let me know if you'd like to use a different approach here however!

Testing

  • Added unit tests for changes

Release Notes

Fixed the usage description of a `BoolWithInverseFlag` to show the inverse prefix in square brackets. 
For example: --[no-]env	(default: false)

@mahadzaryab1 mahadzaryab1 requested a review from a team as a code owner August 17, 2024 16:27
@mahadzaryab1 mahadzaryab1 requested a review from dearchap August 17, 2024 20:58
Copy link
Contributor

@dearchap dearchap left a comment

Choose a reason for hiding this comment

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

Thanks @mahadzaryab1

@dearchap dearchap merged commit 3110c0e into urfave:main Aug 17, 2024
11 checks passed
@mahadzaryab1 mahadzaryab1 deleted the fix-inverse-flag-usage branch August 18, 2024 15:02
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.

How do I define Usage for BoolWithInverseFlag?
2 participants