Delegate completions for a specific argument to the completions of an external program #5424
Open
2 tasks done
Labels
A-completion
Area: completion generator
C-enhancement
Category: Raise on the bar on expectations
S-blocked
Status: Blocked on something else such as an RFC or other implementation work.
S-waiting-on-design
Status: Waiting on user-facing design to be resolved before implementing
Please complete the following tasks
Clap Version
4.5
Describe your use case
I have an app that has several subcommands, some of which are wrappers around other CLI tools. For example
casile
has several subcommands, but one of them iscasile make
that sets up a special environment and this passes all the remaining args tomake
. I have it setup something like this:The
Vec<String>
seems to be the best way to collect further arguments and pass them through to the subprocess. Since passing other flags tomake
is valid here the arguments beyond this point may or may not be filenames, and even if they are they may or may not exist yet which makes filename completion (as I would get if I made this aVec<PathBuf>
or similar not very useful.Describe the solution you'd like
I'd like to be able to specify something in the CLI that specifically called out the command for which to use completions for:
I don't know what the exact ergonomics should be, but somehow I'd like the final generated completion scripts to delegate completions for arguments in this position to the completion script of a different external command.
Alternatives, if applicable
No response
Additional Context
I'm not sure all supported shells have a way to handle this, but at least bash and zsh do.
The text was updated successfully, but these errors were encountered: