Avoid suggesting files in fish command completions.#2114
Merged
dearchap merged 1 commit intourfave:mainfrom Apr 27, 2025
Merged
Avoid suggesting files in fish command completions.#2114dearchap merged 1 commit intourfave:mainfrom
dearchap merged 1 commit intourfave:mainfrom
Conversation
Contributor
|
@bittrance I'm not a fish expert but dont you want fish to suggested files for certain flags ? |
c7c3b7c to
74f70ee
Compare
Contributor
Author
|
@dearchap Oh, aboslutely. With this change there are two situations where you get file suggestions. Example code: app := &cli.Command{
Name: "mycli",
Version: "1.0.0",
Usage: "Pure awesomeness.",
HideHelp: true,
EnableShellCompletion: true,
Suggest: true,
Commands: []*cli.Command{
{
Name: "awesomify",
Usage: "Make awesomer!",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "target-file",
Required: true,
TakesFile: true,
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
return nil
},
},
},
}Case 1: when there is nothing else to suggest: Case 2: When using Flag As far as I can tell, the bash completions behave similarly? |
dearchap
approved these changes
Apr 27, 2025
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:
Ensure not to suggest paths in fish completions when subcommands are expected.
Which issue(s) this PR fixes:
Fixes #2113.
Testing
Release Notes