Skip to content

Commit

Permalink
feat(builder): min_value and required docs updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBackx committed May 14, 2022
1 parent 02b4fed commit e07dc1b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/builder/arg.rs
Expand Up @@ -1289,11 +1289,16 @@ impl<'help> Arg<'help> {
/// `.min_values(2)`, and this argument would be satisfied if the user provided, 2 or more
/// values.
///
/// **NOTE:** This does not implicitly set [`Arg::multiple_occurrences(true)`]. This is because
/// **NOTES:**
/// * This does not implicitly set [`Arg::multiple_occurrences(true)`]. This is because
/// `-o val -o val` is multiple occurrences but a single value and `-o val1 val2` is a single
/// occurrence with multiple values. For positional arguments this **does** set
/// [`Arg::multiple_occurrences(true)`] because there is no way to determine the difference between multiple
/// occurrences and multiple values.
/// * Passing a value of `1` is not the same as specifying [`Arg::required(true)`].
/// This is due to min and max validation only being performed for present arguments,
/// marking them as required will thus perform validation and a min value of 1
/// is unneccessary, ignored if not required.
///
/// # Examples
///
Expand Down Expand Up @@ -1340,6 +1345,7 @@ impl<'help> Arg<'help> {
/// assert_eq!(res.unwrap_err().kind(), ErrorKind::TooFewValues);
/// ```
/// [`Arg::multiple_occurrences(true)`]: Arg::multiple_occurrences()
/// [`Arg::required(true)`]: Arg::required()
#[inline]
#[must_use]
pub fn min_values(mut self, qty: usize) -> Self {
Expand Down

0 comments on commit e07dc1b

Please sign in to comment.