Skip to content

Commit 931aea8

Browse files
committed
docs(Arg): unhides fields of the Arg struct
1 parent 398b467 commit 931aea8

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

src/args/arg.rs

+13-22
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use usageparser::{UsageParser, UsageToken};
2020
/// manually, or using a usage string which is far less verbose. You can also use a combination
2121
/// of the two methods to achieve the best of both worlds.
2222
///
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.
2325
///
2426
/// # Example
2527
///
@@ -38,71 +40,60 @@ use usageparser::{UsageParser, UsageToken};
3840
/// Arg::from_usage("-i --input=[input] 'Provides an input file to the program'")
3941
/// # ).get_matches();
4042
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
4344
pub name: &'n str,
4445
/// The short version (i.e. single character) of the argument, no preceding `-`
4546
/// **NOTE:** `short` is mutually exclusive with `index`
46-
#[doc(hidden)]
4747
pub short: Option<char>,
4848
/// The long version of the flag (i.e. word) without the preceding `--`
4949
/// **NOTE:** `long` is mutually exclusive with `index`
50-
#[doc(hidden)]
5150
pub long: Option<&'l str>,
5251
/// The string of text that will displayed to the user when the application's
5352
/// `help` text is displayed
54-
#[doc(hidden)]
5553
pub help: Option<&'h str>,
5654
/// If this is a required by default when using the command line program
5755
/// i.e. a configuration file that's required for the program to function
5856
/// **NOTE:** required by default means, it is required *until* mutually
5957
/// exclusive arguments are evaluated.
60-
#[doc(hidden)]
6158
pub required: bool,
6259
/// Determines if this argument is an option, vice a flag or positional and
6360
/// is mutually exclusive with `index` and `multiple`
64-
#[doc(hidden)]
6561
pub takes_value: bool,
6662
/// The index of the argument. `index` is mutually exclusive with `takes_value`
6763
/// and `multiple`
68-
#[doc(hidden)]
6964
pub index: Option<u8>,
7065
/// Determines if multiple instances of the same flag are allowed. `multiple`
7166
/// is mutually exclusive with `index` and `takes_value`.
7267
/// I.e. `-v -v -v` or `-vvv`
73-
#[doc(hidden)]
7468
pub multiple: bool,
7569
/// A list of names for other arguments that *may not* be used with this flag
76-
#[doc(hidden)]
7770
pub blacklist: Option<Vec<&'r str>>,
7871
/// A list of possible values for an option or positional argument
79-
#[doc(hidden)]
8072
pub possible_vals: Option<Vec<&'p str>>,
8173
/// A list of names of other arguments that are *required* to be used when
8274
/// this flag is used
83-
#[doc(hidden)]
8475
pub requires: Option<Vec<&'r str>>,
8576
/// A name of the group the argument belongs to
86-
#[doc(hidden)]
8777
pub group: Option<&'g str>,
88-
#[doc(hidden)]
78+
/// A set of names (ordered) for the values to be displayed with the help message
8979
pub val_names: Option<BTreeSet<&'n str>>,
90-
#[doc(hidden)]
80+
/// The exact number of values to satisfy this argument
9181
pub num_vals: Option<u8>,
92-
#[doc(hidden)]
82+
/// The maximum number of values possible for this argument
9383
pub max_vals: Option<u8>,
94-
#[doc(hidden)]
84+
/// The minimum number of values possible to satisfy this argument
9585
pub min_vals: Option<u8>,
96-
#[doc(hidden)]
86+
/// Specifies whether or not this argument accepts explicit empty values such as `--option ""`
9787
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
9990
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.
10193
pub validator: Option<Rc<Fn(String) -> Result<(), String>>>,
10294
/// A list of names for other arguments that *mutually override* this flag
103-
#[doc(hidden)]
10495
pub overrides: Option<Vec<&'r str>>,
105-
#[doc(hidden)]
96+
/// Specifies whether the argument should show up in the help message
10697
pub hidden: bool
10798
}
10899

0 commit comments

Comments
 (0)