mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
feat: add completions for --manifest-path
This commit is contained in:
parent
1d1d646c06
commit
7f94b33b84
@ -10,6 +10,7 @@ use crate::util::important_paths::find_root_manifest_for_wd;
|
||||
use crate::util::interning::InternedString;
|
||||
use crate::util::is_rustup;
|
||||
use crate::util::restricted_names;
|
||||
use crate::util::toml::is_embedded;
|
||||
use crate::util::{
|
||||
print_available_benches, print_available_binaries, print_available_examples,
|
||||
print_available_packages, print_available_tests,
|
||||
@ -325,7 +326,21 @@ pub trait CommandExt: Sized {
|
||||
self._arg(
|
||||
opt("manifest-path", "Path to Cargo.toml")
|
||||
.value_name("PATH")
|
||||
.help_heading(heading::MANIFEST_OPTIONS),
|
||||
.help_heading(heading::MANIFEST_OPTIONS)
|
||||
.add(clap_complete::engine::ArgValueCompleter::new(
|
||||
clap_complete::engine::PathCompleter::any().filter(|path: &Path| {
|
||||
if path.file_name() == Some(OsStr::new("Cargo.toml")) {
|
||||
return true;
|
||||
}
|
||||
if is_embedded(path) {
|
||||
return true;
|
||||
}
|
||||
if path.is_file() && path.extension().is_none() {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}),
|
||||
)),
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user