Skip to content

Commit

Permalink
Merge pull request #5846 from ribru17/alias_fn_dedup
Browse files Browse the repository at this point in the history
fix(complete): remove duplicate bash subcmd cases caused by aliases
  • Loading branch information
epage authored Dec 16, 2024
2 parents b1b6f17 + 48ff72b commit cd622ab
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
1 change: 1 addition & 0 deletions clap_complete/src/aot/shells/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ fn subcommand_details(cmd: &Command) -> String {
.collect::<Vec<_>>();

scs.sort();
scs.dedup();

subcmd_dets.extend(scs.iter().map(|sc| {
format!(
Expand Down
14 changes: 0 additions & 14 deletions clap_complete/tests/snapshots/sub_subcommands.bash
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,6 @@ _my-app() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
my__app__some_cmd)
opts="-h -V --help --version sub_cmd help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
my__app__some_cmd__help)
opts="sub_cmd help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand Down

0 comments on commit cd622ab

Please sign in to comment.