Repository navigation
Conversation
TakesFile is a field of every flag type, but fishAddFileFlag only checked StringFlag and StringSliceFlag, so a GenericFlag or StringMapFlag with TakesFile still got `-f` and fish offered no files for it. v2 also handled GenericFlag. Flags now report it through an unexported method on FlagBase; a flag that takes no value (BoolFlag) keeps `-f`. 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:
TakesFileis a field of every flag type (FlagBase), and its only reader is the fish completion script, butfishAddFileFlagonly checks*StringFlagand*StringSliceFlag. Any other flag withTakesFile: truestill gets-f, so fish completes no files for it:In fish 4.9.3,
complete -C "app --config "lists the files in the directory, whilecomplete -C "app --input "lists nothing. v2'sfishAddFileFlagalso handledGenericFlag(andPathFlag, which v3 replaced withStringFlag+TakesFile).FlagBasenow has an unexportedtakesFile()(TakesFileand the flag takes a value), andfishAddFileFlagchecks for it instead of the two concrete types. So every flag type works, there is no API change (make v3diffis clean), and aBoolFlagwithTakesFilekeeps-f, as it does now, since it has no value to complete.Which issue(s) this PR fixes:
None, found while testing the generated fish script in fish.
Testing
TestFishCompletionTakesFileForAllFlagTypes(StringFlag,GenericFlag,StringMapFlag, a plainStringFlagand aBoolFlag). It fails onmain.--inputand--env-filenow complete files like--config.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