Skip to content

Commit 891a2a0

Browse files
committed
fix: fixes a bug where ZSH completions would panic if the binary name had an underscore in it
Closes #581
1 parent 09a6c0a commit 891a2a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/completions/zsh.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ _{bin_name_underscore}_commands() {{
8686
)
8787
_describe -t commands '{bin_name} commands' commands \"$@\"
8888
}}",
89-
bin_name_underscore = p.meta.bin_name.as_ref().unwrap().replace(" ", "_"),
89+
bin_name_underscore = p.meta.bin_name.as_ref().unwrap().replace(" ", "__"),
9090
bin_name = p.meta.bin_name.as_ref().unwrap(),
9191
subcommands_and_args = subcommands_and_args_of(p))];
9292

@@ -104,7 +104,7 @@ _{bin_name_underscore}_commands() {{
104104
)
105105
_describe -t commands '{bin_name} commands' commands \"$@\"
106106
}}",
107-
bin_name_underscore = bin_name.replace(" ", "_"),
107+
bin_name_underscore = bin_name.replace(" ", "__"),
108108
bin_name = bin_name,
109109
subcommands_and_args = subcommands_and_args_of(parser_of(p, bin_name))));
110110
}
@@ -265,7 +265,7 @@ fn get_args_of(p: &Parser) -> String {
265265
let flags = write_flags_of(p);
266266
let sc_or_a = if p.has_subcommands() || p.has_positionals() {
267267
format!("\"1:: :_{name}_commands\" \\",
268-
name = p.meta.bin_name.as_ref().unwrap().replace(" ", "_"))
268+
name = p.meta.bin_name.as_ref().unwrap().replace(" ", "__"))
269269
} else {
270270
String::new()
271271
};

0 commit comments

Comments
 (0)