Skip to content

Commit cd622ab

Browse files
authored
Merge pull request #5846 from ribru17/alias_fn_dedup
fix(complete): remove duplicate bash subcmd cases caused by aliases
2 parents b1b6f17 + 48ff72b commit cd622ab

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

clap_complete/src/aot/shells/bash.rs

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ fn subcommand_details(cmd: &Command) -> String {
132132
.collect::<Vec<_>>();
133133

134134
scs.sort();
135+
scs.dedup();
135136

136137
subcmd_dets.extend(scs.iter().map(|sc| {
137138
format!(

clap_complete/tests/snapshots/sub_subcommands.bash

-14
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,6 @@ _my-app() {
152152
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
153153
return 0
154154
;;
155-
my__app__some_cmd)
156-
opts="-h -V --help --version sub_cmd help"
157-
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
158-
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
159-
return 0
160-
fi
161-
case "${prev}" in
162-
*)
163-
COMPREPLY=()
164-
;;
165-
esac
166-
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
167-
return 0
168-
;;
169155
my__app__some_cmd__help)
170156
opts="sub_cmd help"
171157
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then

0 commit comments

Comments
 (0)