Support PathFlag.TakesFile in fish completion #1198
Merged
Conversation
Performing reflection on the given flag ensures that fishAddFileFlag will behave correctly if any flag types get a TakesFile field in the future.
Nice, LGTM |
Thanks for putting this together! Left a couple comments with some options for how to go forward. Feel free to head down either path. |
LGTM |
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.
What type of PR is this?
What this PR does / why we need it:
Flags of type
PathFlag
weren't processed correctly when generating fish completions—the generatedcomplete
command told fish that the flag doesn't take a filename, even whenTakesFile
is true.fish.go
now respects theTakesFile
field, regardless of the flag's underlying type.PathFlag
to the list of explicit types in the switch statement.fish_test.go
has a test case for aPathFlag
withTakesFile = true
.expected-fish-full.fish
has a corresponding change in its fixture data.Which issue(s) this PR fixes:
Fixes #1156
Special notes for your reviewer:
@lynncyrin had suggested a lighter-weight form of reflection, but I wasn't able to make the type assertion work. AFAIK go's type system only deals in interfaces and specific, concrete types.
Release Notes