Skip to content

Commit

Permalink
fix(ZSH Completions): fixes an issue where zsh completions caused pan…
Browse files Browse the repository at this point in the history
…ics if there were no subcommands

Closes #754
  • Loading branch information
kbknapp committed Nov 20, 2016
1 parent d20331b commit 49e7cda
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/completions/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ fn subcommands_and_args_of(p: &Parser) -> String {
// [repeat] = From the same recursive calls, but for all subcommands
// [subcommand_args] = The same as zsh::get_args_of
fn get_subcommands_of(p: &Parser) -> String {
debugln!("fn=get_subcommands");
debugln!("fn=get_subcommands_of");

debug!("Has subcommands...");
if !p.has_subcommands() {
Expand Down Expand Up @@ -234,6 +234,9 @@ esac",

fn parser_of<'a, 'b>(p: &'b Parser<'a, 'b>, sc: &str) -> &'b Parser<'a, 'b> {
debugln!("fn=parser_of;sc={}", sc);
if sc == p.meta.bin_name.as_ref().unwrap_or(&String::new()) {
return p;
}
&p.find_subcommand(sc).expect(INTERNAL_ERROR_MSG).p
}

Expand Down

0 comments on commit 49e7cda

Please sign in to comment.