mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Add unsupported short flag suggestion for --exclude
flag
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
parent
718b69ce19
commit
b514ca5e24
@ -64,9 +64,19 @@ pub trait CommandExt: Sized {
|
|||||||
all: &'static str,
|
all: &'static str,
|
||||||
exclude: &'static str,
|
exclude: &'static str,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let unsupported_short_arg = {
|
||||||
|
let value_parser = UnknownArgumentValueParser::suggest_arg("--exclude");
|
||||||
|
Arg::new("unsupported-short-exclude-flag")
|
||||||
|
.help("")
|
||||||
|
.short('x')
|
||||||
|
.value_parser(value_parser)
|
||||||
|
.action(ArgAction::SetTrue)
|
||||||
|
.hide(true)
|
||||||
|
};
|
||||||
self.arg_package_spec_simple(package)
|
self.arg_package_spec_simple(package)
|
||||||
._arg(flag("workspace", all).help_heading(heading::PACKAGE_SELECTION))
|
._arg(flag("workspace", all).help_heading(heading::PACKAGE_SELECTION))
|
||||||
._arg(multi_opt("exclude", "SPEC", exclude).help_heading(heading::PACKAGE_SELECTION))
|
._arg(multi_opt("exclude", "SPEC", exclude).help_heading(heading::PACKAGE_SELECTION))
|
||||||
|
._arg(unsupported_short_arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn arg_package_spec_simple(self, package: &'static str) -> Self {
|
fn arg_package_spec_simple(self, package: &'static str) -> Self {
|
||||||
|
@ -4354,6 +4354,8 @@ fn cargo_build_with_unsupported_short_exclude_flag() {
|
|||||||
"\
|
"\
|
||||||
error: unexpected argument '-x' found
|
error: unexpected argument '-x' found
|
||||||
|
|
||||||
|
tip: a similar argument exists: '--exclude'
|
||||||
|
|
||||||
Usage: cargo[EXE] build [OPTIONS]
|
Usage: cargo[EXE] build [OPTIONS]
|
||||||
|
|
||||||
For more information, try '--help'.
|
For more information, try '--help'.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user