Skip to content

Commit

Permalink
fix(complete): Fix subcommand deduplication in zsh.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
pzmarzly committed Apr 27, 2024
1 parent 43efde9 commit 52e34c3
Show file tree
Hide file tree
Showing 6 changed files with 251 additions and 248 deletions.
11 changes: 7 additions & 4 deletions clap_complete/src/shells/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,15 @@ _{bin_name_underscore}_commands() {{
ret.push(parent_text);

// Next we start looping through all the children, grandchildren, etc.
let mut all_subcommands = utils::all_subcommands(p);
let mut all_subcommand_bins: Vec<_> = utils::all_subcommands(p)
.into_iter()
.map(|(_sc_name, bin_name)| bin_name)
.collect();

all_subcommands.sort();
all_subcommands.dedup();
all_subcommand_bins.sort();
all_subcommand_bins.dedup();

for (_, ref bin_name) in &all_subcommands {
for bin_name in &all_subcommand_bins {
debug!("subcommand_details:iter: bin_name={bin_name}");

ret.push(format!(
Expand Down
Loading

0 comments on commit 52e34c3

Please sign in to comment.