@@ -4,36 +4,37 @@ use std::str::FromStr;
4
4
5
5
bitflags ! {
6
6
flags Flags : u32 {
7
- const SC_NEGATE_REQS = 0b000000000000000000000000000001 ,
8
- const SC_REQUIRED = 0b000000000000000000000000000010 ,
9
- const A_REQUIRED_ELSE_HELP = 0b000000000000000000000000000100 ,
10
- const GLOBAL_VERSION = 0b000000000000000000000000001000 ,
11
- const VERSIONLESS_SC = 0b000000000000000000000000010000 ,
12
- const UNIFIED_HELP = 0b000000000000000000000000100000 ,
13
- const WAIT_ON_ERROR = 0b000000000000000000000001000000 ,
14
- const SC_REQUIRED_ELSE_HELP = 0b000000000000000000000010000000 ,
15
- const NEEDS_LONG_HELP = 0b000000000000000000000100000000 ,
16
- const NEEDS_LONG_VERSION = 0b000000000000000000001000000000 ,
17
- const NEEDS_SC_HELP = 0b000000000000000000010000000000 ,
18
- const DISABLE_VERSION = 0b000000000000000000100000000000 ,
19
- const HIDDEN = 0b000000000000000001000000000000 ,
20
- const TRAILING_VARARG = 0b000000000000000010000000000000 ,
21
- const NO_BIN_NAME = 0b000000000000000100000000000000 ,
22
- const ALLOW_UNK_SC = 0b000000000000001000000000000000 ,
23
- const UTF8_STRICT = 0b000000000000010000000000000000 ,
24
- const UTF8_NONE = 0b000000000000100000000000000000 ,
25
- const LEADING_HYPHEN = 0b000000000001000000000000000000 ,
26
- const NO_POS_VALUES = 0b000000000010000000000000000000 ,
27
- const NEXT_LINE_HELP = 0b000000000100000000000000000000 ,
28
- const DERIVE_DISP_ORDER = 0b000000001000000000000000000000 ,
29
- const COLORED_HELP = 0b000000010000000000000000000000 ,
30
- const COLOR_ALWAYS = 0b000000100000000000000000000000 ,
31
- const COLOR_AUTO = 0b000001000000000000000000000000 ,
32
- const COLOR_NEVER = 0b000010000000000000000000000000 ,
33
- const DONT_DELIM_TRAIL = 0b000100000000000000000000000000 ,
34
- const ALLOW_NEG_NUMS = 0b001000000000000000000000000000 ,
35
- const LOW_INDEX_MUL_POS = 0b010000000000000000000000000000 ,
36
- const DISABLE_HELP_SC = 0b10000000000000000000000000000 ,
7
+ const SC_NEGATE_REQS = 0b0000000000000000000000000000001 ,
8
+ const SC_REQUIRED = 0b0000000000000000000000000000010 ,
9
+ const A_REQUIRED_ELSE_HELP = 0b0000000000000000000000000000100 ,
10
+ const GLOBAL_VERSION = 0b0000000000000000000000000001000 ,
11
+ const VERSIONLESS_SC = 0b0000000000000000000000000010000 ,
12
+ const UNIFIED_HELP = 0b0000000000000000000000000100000 ,
13
+ const WAIT_ON_ERROR = 0b0000000000000000000000001000000 ,
14
+ const SC_REQUIRED_ELSE_HELP = 0b0000000000000000000000010000000 ,
15
+ const NEEDS_LONG_HELP = 0b0000000000000000000000100000000 ,
16
+ const NEEDS_LONG_VERSION = 0b0000000000000000000001000000000 ,
17
+ const NEEDS_SC_HELP = 0b0000000000000000000010000000000 ,
18
+ const DISABLE_VERSION = 0b0000000000000000000100000000000 ,
19
+ const HIDDEN = 0b0000000000000000001000000000000 ,
20
+ const TRAILING_VARARG = 0b0000000000000000010000000000000 ,
21
+ const NO_BIN_NAME = 0b0000000000000000100000000000000 ,
22
+ const ALLOW_UNK_SC = 0b0000000000000001000000000000000 ,
23
+ const UTF8_STRICT = 0b0000000000000010000000000000000 ,
24
+ const UTF8_NONE = 0b0000000000000100000000000000000 ,
25
+ const LEADING_HYPHEN = 0b0000000000001000000000000000000 ,
26
+ const NO_POS_VALUES = 0b0000000000010000000000000000000 ,
27
+ const NEXT_LINE_HELP = 0b0000000000100000000000000000000 ,
28
+ const DERIVE_DISP_ORDER = 0b0000000001000000000000000000000 ,
29
+ const COLORED_HELP = 0b0000000010000000000000000000000 ,
30
+ const COLOR_ALWAYS = 0b0000000100000000000000000000000 ,
31
+ const COLOR_AUTO = 0b0000001000000000000000000000000 ,
32
+ const COLOR_NEVER = 0b0000010000000000000000000000000 ,
33
+ const DONT_DELIM_TRAIL = 0b0000100000000000000000000000000 ,
34
+ const ALLOW_NEG_NUMS = 0b0001000000000000000000000000000 ,
35
+ const LOW_INDEX_MUL_POS = 0b0010000000000000000000000000000 ,
36
+ const DISABLE_HELP_SC = 0b0100000000000000000000000000000 ,
37
+ const DONT_COLLAPSE_ARGS = 0b1000000000000000000000000000000 ,
37
38
}
38
39
}
39
40
@@ -65,6 +66,7 @@ impl AppFlags {
65
66
ColorAuto => COLOR_AUTO ,
66
67
ColorNever => COLOR_NEVER ,
67
68
DontDelimitTrailingValues => DONT_DELIM_TRAIL ,
69
+ DontCollapseArgsInUsage => DONT_COLLAPSE_ARGS ,
68
70
DeriveDisplayOrder => DERIVE_DISP_ORDER ,
69
71
DisableHelpSubcommand => DISABLE_HELP_SC ,
70
72
DisableVersion => DISABLE_VERSION ,
@@ -311,6 +313,18 @@ pub enum AppSettings {
311
313
/// ```
312
314
ColorNever ,
313
315
316
+ /// Disables the automatic collapsing of positional args into `[ARGS]` inside the usage string
317
+ ///
318
+ /// # Examples
319
+ ///
320
+ /// ```no_run
321
+ /// # use clap::{App, Arg, SubCommand, AppSettings};
322
+ /// App::new("myprog")
323
+ /// .setting(AppSettings::DontCollapseArgsInUsage)
324
+ /// .get_matches();
325
+ /// ```
326
+ DontCollapseArgsInUsage ,
327
+
314
328
/// Disables the automatic delimiting of values when `--` or [`AppSettings::TrailingVarArg`]
315
329
/// was used.
316
330
///
@@ -702,6 +716,7 @@ impl FromStr for AppSettings {
702
716
"colornever" => Ok ( AppSettings :: ColorNever ) ,
703
717
"coloredhelp" => Ok ( AppSettings :: ColoredHelp ) ,
704
718
"derivedisplayorder" => Ok ( AppSettings :: DeriveDisplayOrder ) ,
719
+ "dontcollapseargsinusage" => Ok ( AppSettings :: DontCollapseArgsInUsage ) ,
705
720
"dontdelimittrailingvalues" => Ok ( AppSettings :: DontDelimitTrailingValues ) ,
706
721
"disablehelpsubcommand" => Ok ( AppSettings :: DisableHelpSubcommand ) ,
707
722
"disableversion" => Ok ( AppSettings :: DisableVersion ) ,
@@ -752,6 +767,8 @@ mod test {
752
767
AppSettings :: DisableHelpSubcommand ) ;
753
768
assert_eq ! ( "disableversion" . parse:: <AppSettings >( ) . unwrap( ) ,
754
769
AppSettings :: DisableVersion ) ;
770
+ assert_eq ! ( "dontcollapseargsinusage" . parse:: <AppSettings >( ) . unwrap( ) ,
771
+ AppSettings :: DontCollapseArgsInUsage ) ;
755
772
assert_eq ! ( "dontdelimittrailingvalues" . parse:: <AppSettings >( ) . unwrap( ) ,
756
773
AppSettings :: DontDelimitTrailingValues ) ;
757
774
assert_eq ! ( "derivedisplayorder" . parse:: <AppSettings >( ) . unwrap( ) ,
0 commit comments