Skip to content

Commit

Permalink
fix: Ease clap2->clap3 migration with deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Sep 8, 2021
1 parent 0105e6f commit 440eccc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/build/arg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ impl<'help> Arg<'help> {
}
}

/// Deprecated, see [`Arg::new`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::new`")]
pub fn with_name<S: Into<&'help str>>(n: S) -> Self {
Self::new(n)
}

pub(crate) fn generated(mut self) -> Self {
self.provider = ArgProvider::Generated;
self
Expand Down Expand Up @@ -666,6 +672,12 @@ impl<'help> Arg<'help> {
self
}

/// Deprecated, see [`Arg::about`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::about`")]
pub fn help(self, h: &'help str) -> Self {
self.about(h)
}

/// Sets the long help text of the argument that will be displayed to the user when they print
/// the help information with `--help`. Typically this a more detailed (multi-line) message
/// that describes the arg.
Expand Down Expand Up @@ -738,6 +750,12 @@ impl<'help> Arg<'help> {
self
}

/// Deprecated, see [`Arg::long_about`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::long_about`")]
pub fn long_help(self, h: &'help str) -> Self {
self.long_about(h)
}

/// Set this arg as [required] as long as the specified argument is not present at runtime.
///
/// **Pro Tip:** Using `Arg::required_unless_present` implies [`Arg::required`] and is therefore not
Expand Down Expand Up @@ -4392,6 +4410,15 @@ impl<'help> Arg<'help> {
}
}

/// Deprecated, see [`Arg::multiple_occurrences`] and [`Arg::multiple_values`]
#[deprecated(
since = "3.0.0",
note = "Broken out into `Arg::multiple_occurrences` and `Arg::multiple_values`"
)]
pub fn multiple(self, multi: bool) -> Self {
self.multiple_occurrences(multi).multiple_values(multi)
}

/// Indicates that all parameters passed after this should not be parsed
/// individually, but rather passed in their entirety. It is worth noting
/// that setting this requires all values to come after a `--` to indicate they
Expand Down

0 comments on commit 440eccc

Please sign in to comment.