fix: show BoolWithInverseFlag aliases in help text#2321
Open
wucm667 wants to merge 3 commits intourfave:mainfrom
Open
fix: show BoolWithInverseFlag aliases in help text#2321wucm667 wants to merge 3 commits intourfave:mainfrom
wucm667 wants to merge 3 commits intourfave:mainfrom
Conversation
Aliases defined on BoolWithInverseFlag are functional but were not displayed in usage/help output. The String() method only rendered --[no-]<name> without including any aliases. Now aliases are appended after the primary flag name: --[no-]color, -c (default: false) --[no-]color, --colour (default: false) --[no-]color, -c, --colour (default: false) Adds test cases for short alias, long alias, and multiple aliases. Fixes urfave#2216 Signed-off-by: wucm667 <stevenwucongmin@gmail.com>
The String() method now includes aliases in the help text output. Regenerate the documentation file to reflect this change. Signed-off-by: wucm667 <stevenwucongmin@gmail.com>
…pport Sync the v3.x reference godoc file with the generated output. Signed-off-by: wucm667 <stevenwucongmin@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Aliases defined on
BoolWithInverseFlagare functional but were not displayed in usage/help output. TheString()method only rendered--[no-]<name>without including any aliases.Before
After
Changes
flag_bool_with_inverse.go: UpdatedString()to append aliases with correct prefix (-for single-char,--for multi-char)flag_bool_with_inverse_test.go: Added 3 new test cases covering short alias, long alias, and multiple aliasesAll existing tests pass, no breaking changes.
Fixes #2216