Skip to content

Commit

Permalink
fix(bash completion): Change the bash completion script code generati…
Browse files Browse the repository at this point in the history
…on to support hyphens.
  • Loading branch information
Alex Helfet committed Dec 16, 2017
1 parent b446a56 commit ba7f1d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/completions/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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("-", "__")
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ba7f1d1

Please sign in to comment.