Skip to content

Commit

Permalink
fix: fixes a bug where ZSH completions would panic if the binary name…
Browse files Browse the repository at this point in the history
… had an underscore in it

Closes #581
  • Loading branch information
kbknapp committed Feb 3, 2017
1 parent 6744c1f commit 503b7ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/completions/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ _{bin_name_underscore}_commands() {{
)
_describe -t commands '{bin_name} commands' commands \"$@\"
}}",
bin_name_underscore = p.meta.bin_name.as_ref().unwrap().replace(" ", "_"),
bin_name_underscore = p.meta.bin_name.as_ref().unwrap().replace(" ", "__"),
bin_name = p.meta.bin_name.as_ref().unwrap(),
subcommands_and_args = subcommands_and_args_of(p))];

Expand All @@ -104,7 +104,7 @@ _{bin_name_underscore}_commands() {{
)
_describe -t commands '{bin_name} commands' commands \"$@\"
}}",
bin_name_underscore = bin_name.replace(" ", "_"),
bin_name_underscore = bin_name.replace(" ", "__"),
bin_name = bin_name,
subcommands_and_args = subcommands_and_args_of(parser_of(p, bin_name))));
}
Expand Down Expand Up @@ -265,7 +265,7 @@ fn get_args_of(p: &Parser) -> String {
let flags = write_flags_of(p);
let sc_or_a = if p.has_subcommands() || p.has_positionals() {
format!("\"1:: :_{name}_commands\" \\",
name = p.meta.bin_name.as_ref().unwrap().replace(" ", "_"))
name = p.meta.bin_name.as_ref().unwrap().replace(" ", "__"))
} else {
String::new()
};
Expand Down

0 comments on commit 503b7ec

Please sign in to comment.