diff --git a/clap_complete/src/aot/shells/bash.rs b/clap_complete/src/aot/shells/bash.rs index d283401949d..6d0be2d297c 100644 --- a/clap_complete/src/aot/shells/bash.rs +++ b/clap_complete/src/aot/shells/bash.rs @@ -132,6 +132,7 @@ fn subcommand_details(cmd: &Command) -> String { .collect::>(); scs.sort(); + scs.dedup(); subcmd_dets.extend(scs.iter().map(|sc| { format!( diff --git a/clap_complete/tests/snapshots/sub_subcommands.bash b/clap_complete/tests/snapshots/sub_subcommands.bash index a6a4663503d..6651d025d91 100644 --- a/clap_complete/tests/snapshots/sub_subcommands.bash +++ b/clap_complete/tests/snapshots/sub_subcommands.bash @@ -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