-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
bash generated completions invalid when command name contains spaces #4822
Comments
What we should do is add an assert that |
Then why is the second half of the generated output using
|
I've understood the structure of the bash completion function to be roughly this:
The first part is generated by Hence my assumption that the first part should also use those exact same strings. |
I triggered something very similar by having a crate named
Once I added |
Please complete the following tasks
Rust Version
rustc 1.67.0 (fc594f156 2023-01-24)
Clap Version
4.2.1
Minimal reproducible code
Cargo.toml
main.rs
:Steps to reproduce the bug with the above code
Actual Behaviour
The generated bash and zsh completions files are not valid, because either generator uses
cmd.get_name()
instead ofcmd.get_bin_name()
as the parent command.You can see this most easily when trying to execute the generated bash output:
The Zsh generated output is similarly broken; using the
shellcheck
linter:Expected Behaviour
The parent name for a completion subcommand should be
cmd.get_bin_name()
(in the MRCE:mrce_clap_generate
), and notcmd.get_name()
(MCRE for clap generate output
in the MRCE).If I manually replace
MCRE for clap generate output
withmcre_clap_generate
in the generated output, the completions work as expected.Additional Context
No response
Debug Output
The text was updated successfully, but these errors were encountered: