fix(bash completion): Change the bash completion script code generation to support hyphens.

This commit is contained in:
Alex Helfet 2017-12-16 10:50:19 +00:00
parent b446a561ce
commit ba7f1d18eb
2 changed files with 4 additions and 3 deletions

View file

@ -81,10 +81,11 @@ complete -F _{name} -o bashdefault -o default {name}
subcmds = format!(
"{}
{name})
cmd+=\"__{name}\"
cmd+=\"__{fn_name}\"
;;",
subcmds,
name = sc.replace("-", "__")
name = sc,
fn_name = sc.replace("-", "__")
);
}

View file

@ -525,7 +525,7 @@ static BASH_SPECIAL_CMDS: &'static str = r#"_my_app() {
help)
cmd+="__help"
;;
some__cmd__with__hypens)
some-cmd-with-hypens)
cmd+="__some__cmd__with__hypens"
;;
some_cmd)