Skip to content

Commit 15ba97e

Browse files
committed
Auto merge of #14536 - shannmu:_cargo_unstable_flags, r=epage
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>`
2 parents e7ca9be + 455c1ab commit 15ba97e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/bin/cargo/cli.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,15 @@ See '<cyan,bold>cargo help</> <cyan><<command>></>' for more information on a sp
682682
.short('Z')
683683
.value_name("FLAG")
684684
.action(ArgAction::Append)
685-
.global(true))
685+
.global(true)
686+
.add(clap_complete::ArgValueCandidates::new(|| {
687+
let flags = CliUnstable::help();
688+
flags.into_iter().map(|flag| {
689+
clap_complete::CompletionCandidate::new(flag.0.replace("_", "-")).help(flag.1.map(|help| {
690+
help.into()
691+
}))
692+
}).collect()
693+
})))
686694
.subcommands(commands::builtin())
687695
}
688696

0 commit comments

Comments
 (0)