Skip to content

Commit

Permalink
Auto merge of #14536 - shannmu:_cargo_unstable_flags, r=epage
Browse files Browse the repository at this point in the history
feat: Add custom completer for `cargo -Z <TAB>`

### What does this PR try to resolve?
Tracking issue #14520

Add custom completer for `cargo -Z <TAB>`
  • Loading branch information
bors committed Sep 16, 2024
2 parents 654a433 + 8b2f08c commit 75ab4e5
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 75ab4e5

Please sign in to comment.