From 931aea88427edf43a3da90d5a500c1ff2b2c3614 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sun, 20 Sep 2015 20:34:20 -0400 Subject: [PATCH] docs(Arg): unhides fields of the Arg struct --- src/args/arg.rs | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/args/arg.rs b/src/args/arg.rs index 028db5a0..29b25c51 100644 --- a/src/args/arg.rs +++ b/src/args/arg.rs @@ -20,6 +20,8 @@ use usageparser::{UsageParser, UsageToken}; /// manually, or using a usage string which is far less verbose. You can also use a combination /// of the two methods to achieve the best of both worlds. /// +/// **NOTE*: Fields of this struct are **not** meant to be used directly unless absolutely +/// required. 99.9% of the tasks can be performed without accessing these fields directly. /// /// # Example /// @@ -38,71 +40,60 @@ use usageparser::{UsageParser, UsageToken}; /// Arg::from_usage("-i --input=[input] 'Provides an input file to the program'") /// # ).get_matches(); pub struct Arg<'n, 'l, 'h, 'g, 'p, 'r> { - /// The unique name of the argument, required - #[doc(hidden)] + /// The unique name of the argument pub name: &'n str, /// The short version (i.e. single character) of the argument, no preceding `-` /// **NOTE:** `short` is mutually exclusive with `index` - #[doc(hidden)] pub short: Option, /// The long version of the flag (i.e. word) without the preceding `--` /// **NOTE:** `long` is mutually exclusive with `index` - #[doc(hidden)] pub long: Option<&'l str>, /// The string of text that will displayed to the user when the application's /// `help` text is displayed - #[doc(hidden)] pub help: Option<&'h str>, /// If this is a required by default when using the command line program /// i.e. a configuration file that's required for the program to function /// **NOTE:** required by default means, it is required *until* mutually /// exclusive arguments are evaluated. - #[doc(hidden)] pub required: bool, /// Determines if this argument is an option, vice a flag or positional and /// is mutually exclusive with `index` and `multiple` - #[doc(hidden)] pub takes_value: bool, /// The index of the argument. `index` is mutually exclusive with `takes_value` /// and `multiple` - #[doc(hidden)] pub index: Option, /// Determines if multiple instances of the same flag are allowed. `multiple` /// is mutually exclusive with `index` and `takes_value`. /// I.e. `-v -v -v` or `-vvv` - #[doc(hidden)] pub multiple: bool, /// A list of names for other arguments that *may not* be used with this flag - #[doc(hidden)] pub blacklist: Option>, /// A list of possible values for an option or positional argument - #[doc(hidden)] pub possible_vals: Option>, /// A list of names of other arguments that are *required* to be used when /// this flag is used - #[doc(hidden)] pub requires: Option>, /// A name of the group the argument belongs to - #[doc(hidden)] pub group: Option<&'g str>, - #[doc(hidden)] + /// A set of names (ordered) for the values to be displayed with the help message pub val_names: Option>, - #[doc(hidden)] + /// The exact number of values to satisfy this argument pub num_vals: Option, - #[doc(hidden)] + /// The maximum number of values possible for this argument pub max_vals: Option, - #[doc(hidden)] + /// The minimum number of values possible to satisfy this argument pub min_vals: Option, - #[doc(hidden)] + /// Specifies whether or not this argument accepts explicit empty values such as `--option ""` pub empty_vals: bool, - #[doc(hidden)] + /// Specifies whether or not this argument is global and should be propogated through all + /// child subcommands pub global: bool, - #[doc(hidden)] + /// A function used to check the validity of an argument value. Failing this validation results + /// in failed argument parsing. pub validator: Option Result<(), String>>>, /// A list of names for other arguments that *mutually override* this flag - #[doc(hidden)] pub overrides: Option>, - #[doc(hidden)] + /// Specifies whether the argument should show up in the help message pub hidden: bool }