@@ -20,6 +20,8 @@ use usageparser::{UsageParser, UsageToken};
20
20
/// manually, or using a usage string which is far less verbose. You can also use a combination
21
21
/// of the two methods to achieve the best of both worlds.
22
22
///
23
+ /// **NOTE*: Fields of this struct are **not** meant to be used directly unless absolutely
24
+ /// required. 99.9% of the tasks can be performed without accessing these fields directly.
23
25
///
24
26
/// # Example
25
27
///
@@ -38,71 +40,60 @@ use usageparser::{UsageParser, UsageToken};
38
40
/// Arg::from_usage("-i --input=[input] 'Provides an input file to the program'")
39
41
/// # ).get_matches();
40
42
pub struct Arg < ' n , ' l , ' h , ' g , ' p , ' r > {
41
- /// The unique name of the argument, required
42
- #[ doc( hidden) ]
43
+ /// The unique name of the argument
43
44
pub name : & ' n str ,
44
45
/// The short version (i.e. single character) of the argument, no preceding `-`
45
46
/// **NOTE:** `short` is mutually exclusive with `index`
46
- #[ doc( hidden) ]
47
47
pub short : Option < char > ,
48
48
/// The long version of the flag (i.e. word) without the preceding `--`
49
49
/// **NOTE:** `long` is mutually exclusive with `index`
50
- #[ doc( hidden) ]
51
50
pub long : Option < & ' l str > ,
52
51
/// The string of text that will displayed to the user when the application's
53
52
/// `help` text is displayed
54
- #[ doc( hidden) ]
55
53
pub help : Option < & ' h str > ,
56
54
/// If this is a required by default when using the command line program
57
55
/// i.e. a configuration file that's required for the program to function
58
56
/// **NOTE:** required by default means, it is required *until* mutually
59
57
/// exclusive arguments are evaluated.
60
- #[ doc( hidden) ]
61
58
pub required : bool ,
62
59
/// Determines if this argument is an option, vice a flag or positional and
63
60
/// is mutually exclusive with `index` and `multiple`
64
- #[ doc( hidden) ]
65
61
pub takes_value : bool ,
66
62
/// The index of the argument. `index` is mutually exclusive with `takes_value`
67
63
/// and `multiple`
68
- #[ doc( hidden) ]
69
64
pub index : Option < u8 > ,
70
65
/// Determines if multiple instances of the same flag are allowed. `multiple`
71
66
/// is mutually exclusive with `index` and `takes_value`.
72
67
/// I.e. `-v -v -v` or `-vvv`
73
- #[ doc( hidden) ]
74
68
pub multiple : bool ,
75
69
/// A list of names for other arguments that *may not* be used with this flag
76
- #[ doc( hidden) ]
77
70
pub blacklist : Option < Vec < & ' r str > > ,
78
71
/// A list of possible values for an option or positional argument
79
- #[ doc( hidden) ]
80
72
pub possible_vals : Option < Vec < & ' p str > > ,
81
73
/// A list of names of other arguments that are *required* to be used when
82
74
/// this flag is used
83
- #[ doc( hidden) ]
84
75
pub requires : Option < Vec < & ' r str > > ,
85
76
/// A name of the group the argument belongs to
86
- #[ doc( hidden) ]
87
77
pub group : Option < & ' g str > ,
88
- # [ doc ( hidden ) ]
78
+ /// A set of names (ordered) for the values to be displayed with the help message
89
79
pub val_names : Option < BTreeSet < & ' n str > > ,
90
- # [ doc ( hidden ) ]
80
+ /// The exact number of values to satisfy this argument
91
81
pub num_vals : Option < u8 > ,
92
- # [ doc ( hidden ) ]
82
+ /// The maximum number of values possible for this argument
93
83
pub max_vals : Option < u8 > ,
94
- # [ doc ( hidden ) ]
84
+ /// The minimum number of values possible to satisfy this argument
95
85
pub min_vals : Option < u8 > ,
96
- # [ doc ( hidden ) ]
86
+ /// Specifies whether or not this argument accepts explicit empty values such as `--option ""`
97
87
pub empty_vals : bool ,
98
- #[ doc( hidden) ]
88
+ /// Specifies whether or not this argument is global and should be propogated through all
89
+ /// child subcommands
99
90
pub global : bool ,
100
- #[ doc( hidden) ]
91
+ /// A function used to check the validity of an argument value. Failing this validation results
92
+ /// in failed argument parsing.
101
93
pub validator : Option < Rc < Fn ( String ) -> Result < ( ) , String > > > ,
102
94
/// A list of names for other arguments that *mutually override* this flag
103
- #[ doc( hidden) ]
104
95
pub overrides : Option < Vec < & ' r str > > ,
105
- # [ doc ( hidden ) ]
96
+ /// Specifies whether the argument should show up in the help message
106
97
pub hidden : bool
107
98
}
108
99
0 commit comments