-
-
Notifications
You must be signed in to change notification settings - Fork 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
Using a binary name with an underscore leads to panic on completion generation #581
Comments
Hello, I think I have the same error, but I'm using the standard way of declaring subcommands and args. For a small test case, see https://github.com/guiniol/dnsmole . It doesn't do anything except handle subcommands and args for now. Trying to run Cheers, |
I do not use subcommands at all, but it still crashes. |
So. I did a bit more testing and the problem seems to positional arguments in subcommands |
Thanks for filing this! I'm going through all the issues and PRs that accumulated while I was traveling. I should be able to get to this shortly. I'll post back with any questions or findings 😉 |
@ruabmbua I'm finally back from all my travels. Can you give me some more details on this error? I'm not quite clear on what code is making it panic. If we can't figure it out that way, you can compile clap with the [dependencies]
clap = {version = "2.10.0", features = ["debug"] } |
@kbknapp sadly I am going on a travel for a week starting today ^^. I already noticed, that my line markings in the github links are wrong, but you could try finding the line by checking out the HEAD from the issues creation date. |
Ah ok, I see now. I'll do some testing and see what I can find. |
Just pinging: Any updates on this issue? I'm observing the same for 'bash' and 'zsh' in clap 2.18.0. |
@lukaspustina can you give me a minimal example that's causing the panic? Also, if you compile clap with the |
@kbknapp sorry, I should have presented more information. I'll be quite busy today, but might be able to prepare what you're asking for tmr. Meanwhile, if you're interested, I created a branch of my project in which the problem occurs; cf. https://github.com/lukaspustina/bosun_emitter/tree/shell_completions. |
Thanks, I'll try to do the testing tonight after work on that branch. Once I check the |
Alright. Please let me know, if I can be of any assistance. |
I found the issue. This is caused by having a binary name that includes an underscore ( The quick fix is to use a binary name that doesn't include an underscore. I'll work on a solution to work around this in clap but it may be complicated. At the very least, this should be documented in the completion documentations. |
Hi @kbknapp, thanks for looking into the issue and finding the reason. Unfortunately, renaming the binary is not an option since we use it in a many scripts. But I'm patient and wait until you'll find time to fix the underlying problems. Thanks again. |
@kbknapp thanks for looking into it. Now I can use auto completion too :-). |
@lukaspustina once #843 merges I'll put out v2.20.3 on crates.io at which point completion works even with underscores in the names. Apologies for the wait! |
@kbknapp Don't you worry. I'm happy you found time to fix this :) |
I tried to upgrade clap-rs on my command line utility and include the new awesome bash completion generation in my build.rs file. I followed the recommendation to how do things in the docs, but my build.rs files panics at execution.
Error backtrace
I think the error is sub command related becaue of this line of code, where the nasty unwrap lies: Bad Code
The code used for clap::App generation looks like this: The Code
The text was updated successfully, but these errors were encountered: