-
-
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
zsh completion fails when subcommands have aliases #714
Comments
Thanks for posting all these details! The Could you do me a quick favor and change your
Then re-run it and post the debug output? This should be an easy fix! |
Thank you for your answer! Here it is, on macOs this time. It is quite long though :) |
@nicompte Thanks! It looks like it's failing to locate the subcommand |
Unfortunately this project is not open source, I can show you how it's constructed though. The idea is that the But their is no (probably not compiling code) // log subcommand builder
pub fn logs_build() -> App<'static, 'static> {
SubCommand::with_name(LOG)
.about("log")
.alias(LOGS)
.alias(TAIL)
// other options
}
// the two subcommands that use logs, like `fcy api logs`
pub fn build_api() -> App<'static, 'static> {
SubCommand::with_name(API)
.setting(AppSettings::SubcommandRequiredElseHelp)
.about("api")
.subcommand(logs_build())
// other subcommands
}
pub fn build_front() -> App<'static, 'static> {
SubCommand::with_name(FRONT)
.setting(AppSettings::SubcommandRequiredElseHelp)
.about("front")
.subcommand(logs_build())
// other subcommands
}
// cli creation
App::new("fcy")
.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::SubcommandRequiredElseHelp)
.global_setting(AppSettings::ColoredHelp)
.global_setting(AppSettings::VersionlessSubcommands)
.version(env!("CARGO_PKG_VERSION"))
.author(env!("CARGO_PKG_AUTHORS"))
.about(env!("CARGO_PKG_DESCRIPTION"))
.version_short("v")
.subcommand(build_api())
.subcommand(build_front())
// other subcommands Hope that helps, I'll try removing/adding some parts of my code to see when/where it fails. |
Ok it went faster than I expected, the problem seems to be the aliases of the |
Oh wow, thanks for the detailed look! Ok, so then it may be aliases that's the actual bug. Let me do some testing on my local machine and see if I can either reproduce the issue, or come up with a test case to get this fixed for you. |
Alright I've reproduced the issue, and it is in fact due to aliases. Once I have the fix, I'll post back here. |
@kbknapp: it works fine on the latest version, thanks for your quick fix and all your work on clap 👍 |
I'm trying to generate the zsh completion in my
build.rs
file, using clap2.16.2
:But the last line makes the build fail (bash and fish work fine):
And with the
debug
feature, if that's the way to get more information:Any idea of how I could fix it?
The text was updated successfully, but these errors were encountered: