Custom completions should support subcommands after flags
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 85
Description
Related problem
I would like to be able to represent subcommands after flags when working with custom completions:
Often the top level command will have flags that it's necessary to put before the subcommand.
$ cmd --flag subcmd --subflag foo
My naive way of representing this command would be:
export extern cmd [
--flag
...args
]
export extern "cmd subcmd" [
--subflag
bar: string
]
But then the completions bottom out after cmd --flag, and I don't get the completions for subcmd
Describe the solution you'd like
It would be great if cmd <options> subcmd just worked, so that after the flags, it "passes through" to the extern "cmd subcmd" definition and uses those completions.
Describe alternatives you've considered
No response
Additional context and details
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the custom completion definitions shown in the issue, especially how extern cmd and extern "cmd subcmd" are selected after flags. Reproduce cmd --flag subcmd --subflag foo and trace completion handling for ...args; done means subcommand completions remain available after top-level flags and the existing extern "cmd subcmd" definition supplies them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100