Repository navigation
Conversation
…l flag The completion only offered a flag's first name, and skipped it after "--" when it is one letter. So a flag named "v" with the alias "verbose" could not be completed as --verbose, and a BoolWithInverseFlag's --no-color was never offered. The fish completion offers both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What type of PR is this?
What this PR does / why we need it:
The dynamic shell completion only offers a flag's first name, and after
--it skips a flag whose first name is one letter. So two kinds of flags can't be completed in their long form:In bash 5.3 with bash-completion and the script from
app completion bash:mainapp --ver<TAB>--verboseapp --no<TAB>--no-colorapp --<TAB>--color --help--verbose --color --no-color --helpThe fish script from
ToFishCompletionalready offers both, withcomplete … -s v -l verboseandcomplete … -l color -l no-color.help.go:printFlagSuggestionsgets the names to offer from a newcompletionNames. That is the flag's first name as before, except that after--a flag whose first name is one letter offers its first long alias (and is still skipped if it has none). ABoolWithInverseFlagalso offers the inverse of that name, with itsInversePrefix. After a single-, a flag namedvis still offered as-v.help_test.go: four cases inTestDefaultCompleteWithFlags: the long alias after--;-vstill offered after-;--nocompleting--no-colorand--no-dry-run(the inverse of a long alias); and a customInversePrefix.Which issue(s) this PR fixes:
None, found while comparing the dynamic completion with the fish script.
Testing
main. The-vcase passes on both, since it checks what doesn't change.make all,make test GFLAGS='--tags urfave_cli_no_template',make lint,make diffcheckandmake v3diffpass, and so do theurfave_cli_no_docsandurfave_cli_no_suggesttags.check-binary-size: the example CLI (linux/amd64, Go 1.27.3,-s -w, minus hello world) goes from 2.261MB to 2.265MB, which still rounds to 2.3MB.Release Notes
🤖 Generated with Claude Code