Skip to content

Commit

Permalink
feat: Add custom completer for cargo -Z <TAB>
Browse files Browse the repository at this point in the history
  • Loading branch information
shannmu committed Sep 15, 2024
1 parent 468f150 commit 8b2f08c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/bin/cargo/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,15 @@ See '<cyan,bold>cargo help</> <cyan><<command>></>' for more information on a sp
.short('Z')
.value_name("FLAG")
.action(ArgAction::Append)
.global(true))
.global(true)
.add(clap_complete::ArgValueCandidates::new(|| {
let flags = CliUnstable::help();
flags.into_iter().map(|flag| {
clap_complete::CompletionCandidate::new(flag.0.replace("_", "-")).help(flag.1.map(|help| {
help.into()
}))
}).collect()
})))
.subcommands(commands::builtin())
}

Expand Down

0 comments on commit 8b2f08c

Please sign in to comment.