Repository navigation
Conversation
…cript ToFishCompletion only offered a command's own flags, so after a subcommand fish never suggested a root flag such as --config, although the subcommand accepts it and its help lists it under GLOBAL OPTIONS. Add the command's visible persistent flags, as the dynamic completion does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vidigoat
force-pushed
the
fix/fish-persistent-flags
branch
from
October 27, 2026 02:28
d2fe51c to
7b83486
Compare
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:
In v3 a flag is persistent unless it is
Local, so a subcommand accepts its ancestors' flags, and its help lists them under GLOBAL OPTIONS.ToFishCompletiononly offered each command's own flags, and the root's flags only before any subcommand, so after a subcommand fish never suggested them:In fish 4.9.3 with the generated script,
complete -C 'app deploy --'listed--dry-run --help, whileapp deploy --verbose prodruns andapp deploy prod --helpshows--configand--verboseunder GLOBAL OPTIONS. The dynamic completion (app completion fish) already offers them, sinceDefaultCompleteWithFlagsaddsVisiblePersistentFlags.fish.go:prepareFishFlagsnow adds the command'sVisiblePersistentFlags()that it doesn't define itself, the same wayDefaultCompleteWithFlagsdoes.VisiblePersistentFlagsalready leaves outLocalflags and flags a subcommand redefines.testdata/expected-fish-full.fishandtestdata/expected-help-output.txt: regenerated. Both only gain lines, the persistent flags under each subcommand, and no existing line changes.With this change,
complete -Cgives the same flags with the static script as with the dynamic one at every subcommand level:app deploy --andapp deploy prod --both list--config --dry-run --help --verbose,--local-onlystays at the root, andapp deploy -ccompletes file names.Which issue(s) this PR fixes:
None, found while comparing the static and dynamic fish scripts.
Testing
TestFishCompletionPersistentFlags: a root flag is offered after a subcommand and a nested subcommand (fails onmain), while aLocalroot flag and a root flag the subcommand redefines are not.make(generate, vet, tests, binary size, gfmrun),make lintandmake v3diffpass.go test -racepasses, as do the tests withurfave_cli_no_template,urfave_cli_no_docsandurfave_cli_no_suggest.The change and the test were written with Claude Code (AI).
Release Notes
🤖 Generated with Claude Code