8000 Simpler top-level context detection for fish completions by bittrance · Pull Request #2121 · urfave/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Simpler top-level context detection for fish completions #2121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2025

Conversation

bittrance
Copy link
Contributor

What type of PR is this?

  • optimization

What this PR does / why we need it:

Three optimizations:

  1. Previously, completions checked against all levels of subcommands. In case a cli has hundreds of subcommands, this lookup would be a significant effort. This change has it look only for top-level commands, which must necessarily be present before their children.
  2. Add hidden top-level commands to the list that were previously not in the list. Before, this would confuse completions inside hidden commands. (Additional issue related to completion inside
  3. Stop adding help commands in the fish completion code; ensureHelp() has already seen to this.

Which issue(s) this PR fixes:

None. I can make one if it helps. This is in preparation for #2120.

Special notes for your reviewer:

For full disclosure, I probably do not know enough about urfave/cli to say conclusively that there is no way you can "skip" a level such that a deeper sub-command could show up without being preceded by its parent?

Testing

Current main (53ad542) will give this result when more-awesome has Hidden: true before 2. above is addressed.

$ mycli more-awesome -- <tab>
--global-opt  --help  (show help)  --version  (print the version)

Release Notes

Remove superfluous parts from fish completions.

For less confusion, I'll save the bits about hidden command completion for the next PR.

Previously, completions checked against all levels of subcommands.
This change has it look only for top-level commands, which must
necessarily be present before their children. It also adds hidden
top-level commands to the list.
@bittrance bittrance requested a review from a team as a code owner April 28, 2025 20:16
@dearchap dearchap merged commit 2668153 into urfave:main Apr 29, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0