File tree 3 files changed +50
-1
lines changed
3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ pub fn cli() -> Command {
36
36
. arg ( unsupported ( "relative-path" ) )
37
37
. arg ( unsupported ( "only-git-deps" ) )
38
38
. arg ( unsupported ( "disallow-duplicates" ) )
39
- . arg_quiet ( )
39
+ . arg_quiet_without_unknown_silent_arg_tip ( )
40
40
. arg_manifest_path ( )
41
41
. after_help ( color_print:: cstr!(
42
42
"Run `<cyan,bold>cargo help vendor</>` for more detailed information.\n "
Original file line number Diff line number Diff line change @@ -331,6 +331,18 @@ pub trait CommandExt: Sized {
331
331
}
332
332
333
333
fn arg_quiet ( self ) -> Self {
334
+ let unsupported_silent_arg = {
335
+ let value_parser = UnknownArgumentValueParser :: suggest_arg ( "--quiet" ) ;
336
+ flag ( "silent" , "" )
337
+ . short ( 's' )
338
+ . value_parser ( value_parser)
339
+ . hide ( true )
340
+ } ;
341
+ self . _arg ( flag ( "quiet" , "Do not print cargo log messages" ) . short ( 'q' ) )
342
+ . _arg ( unsupported_silent_arg)
343
+ }
344
+
345
+ fn arg_quiet_without_unknown_silent_arg_tip ( self ) -> Self {
334
346
self . _arg ( flag ( "quiet" , "Do not print cargo log messages" ) . short ( 'q' ) )
335
347
}
336
348
Original file line number Diff line number Diff line change @@ -37,6 +37,43 @@ fn quiet_arg() {
37
37
. run ( ) ;
38
38
}
39
39
40
+ #[ cargo_test]
41
+ fn unsupported_silent_arg ( ) {
42
+ let p = project ( )
43
+ . file ( "src/main.rs" , r#"fn main() { println!("hello"); }"# )
44
+ . build ( ) ;
45
+
46
+ p. cargo ( "run -s" )
47
+ . with_stderr (
48
+ "\
49
+ error: unexpected argument '--silent' found
50
+
51
+ tip: a similar argument exists: '--quiet'
52
+
53
+ Usage: cargo[EXE] run [OPTIONS] [args]...
54
+
55
+ For more information, try '--help'.
56
+ " ,
57
+ )
58
+ . with_status ( 1 )
59
+ . run ( ) ;
60
+
61
+ p. cargo ( "run --silent" )
62
+ . with_stderr (
63
+ "\
64
+ error: unexpected argument '--silent' found
65
+
66
+ tip: a similar argument exists: '--quiet'
67
+
68
+ Usage: cargo[EXE] run [OPTIONS] [args]...
69
+
70
+ For more information, try '--help'.
71
+ " ,
72
+ )
73
+ . with_status ( 1 )
74
+ . run ( ) ;
75
+ }
76
+
40
77
#[ cargo_test]
41
78
fn quiet_arg_and_verbose_arg ( ) {
42
79
let p = project ( )
You can’t perform that action at this time.
0 commit comments