Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Hide items deprecated in 3.0.0 #3458

Merged
merged 1 commit into from Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/build/app.rs
Expand Up @@ -3615,6 +3615,7 @@ impl<'help> App<'help> {
since = "3.0.0",
note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
)]
#[doc(hidden)]
pub fn from_yaml(y: &'help Yaml) -> Self {
#![allow(deprecated)]
let yaml_file_hash = y.as_hash().expect("YAML file must be a hash");
Expand Down Expand Up @@ -3702,55 +3703,63 @@ impl<'help> App<'help> {

/// Deprecated, replaced with [`App::override_usage`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::override_usage`")]
#[doc(hidden)]
#[must_use]
pub fn usage<S: Into<&'help str>>(self, usage: S) -> Self {
self.override_usage(usage)
}

/// Deprecated, replaced with [`App::override_help`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::override_help`")]
#[doc(hidden)]
#[must_use]
pub fn help<S: Into<&'help str>>(self, help: S) -> Self {
self.override_help(help)
}

/// Deprecated, replaced with [`App::mut_arg`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`")]
#[doc(hidden)]
#[must_use]
pub fn help_short(self, c: char) -> Self {
self.mut_arg("help", |a| a.short(c))
}

/// Deprecated, replaced with [`App::mut_arg`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`")]
#[doc(hidden)]
#[must_use]
pub fn version_short(self, c: char) -> Self {
self.mut_arg("version", |a| a.short(c))
}

/// Deprecated, replaced with [`App::mut_arg`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`")]
#[doc(hidden)]
#[must_use]
pub fn help_message(self, s: impl Into<&'help str>) -> Self {
self.mut_arg("help", |a| a.help(s.into()))
}

/// Deprecated, replaced with [`App::mut_arg`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`")]
#[doc(hidden)]
#[must_use]
pub fn version_message(self, s: impl Into<&'help str>) -> Self {
self.mut_arg("version", |a| a.help(s.into()))
}

/// Deprecated, replaced with [`App::help_template`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::help_template`")]
#[doc(hidden)]
#[must_use]
pub fn template<S: Into<&'help str>>(self, s: S) -> Self {
self.help_template(s)
}

/// Deprecated, replaced with [`App::setting(a| b)`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::setting(a | b)`")]
#[doc(hidden)]
#[must_use]
pub fn settings(mut self, settings: &[AppSettings]) -> Self {
for s in settings {
Expand All @@ -3761,6 +3770,7 @@ impl<'help> App<'help> {

/// Deprecated, replaced with [`App::unset_setting(a| b)`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::unset_setting(a | b)`")]
#[doc(hidden)]
#[must_use]
pub fn unset_settings(mut self, settings: &[AppSettings]) -> Self {
for s in settings {
Expand All @@ -3771,6 +3781,7 @@ impl<'help> App<'help> {

/// Deprecated, replaced with [`App::global_setting(a| b)`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::global_setting(a | b)`")]
#[doc(hidden)]
#[must_use]
pub fn global_settings(mut self, settings: &[AppSettings]) -> Self {
for s in settings {
Expand All @@ -3782,13 +3793,15 @@ impl<'help> App<'help> {

/// Deprecated, replaced with [`App::term_width`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::term_width`")]
#[doc(hidden)]
#[must_use]
pub fn set_term_width(self, width: usize) -> Self {
self.term_width(width)
}

/// Deprecated in [Issue #3086](https://github.com/clap-rs/clap/issues/3086), see [`arg!`][crate::arg!].
#[deprecated(since = "3.0.0", note = "Deprecated in Issue #3086, see `clap::arg!")]
#[doc(hidden)]
#[must_use]
pub fn arg_from_usage(self, usage: &'help str) -> Self {
#![allow(deprecated)]
Expand All @@ -3797,6 +3810,7 @@ impl<'help> App<'help> {

/// Deprecated in [Issue #3086](https://github.com/clap-rs/clap/issues/3086), see [`arg!`][crate::arg!].
#[deprecated(since = "3.0.0", note = "Deprecated in Issue #3086, see `clap::arg!")]
#[doc(hidden)]
#[must_use]
pub fn args_from_usage(mut self, usage: &'help str) -> Self {
#![allow(deprecated)]
Expand All @@ -3812,24 +3826,28 @@ impl<'help> App<'help> {

/// Deprecated, replaced with [`App::render_version`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::render_version`")]
#[doc(hidden)]
pub fn write_version<W: Write>(&self, w: &mut W) -> ClapResult<()> {
write!(w, "{}", self.render_version()).map_err(From::from)
}

/// Deprecated, replaced with [`App::render_long_version`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::render_long_version`")]
#[doc(hidden)]
pub fn write_long_version<W: Write>(&self, w: &mut W) -> ClapResult<()> {
write!(w, "{}", self.render_long_version()).map_err(From::from)
}

/// Deprecated, replaced with [`App::try_get_matches`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::try_get_matches`")]
#[doc(hidden)]
pub fn get_matches_safe(self) -> ClapResult<ArgMatches> {
self.try_get_matches()
}

/// Deprecated, replaced with [`App::try_get_matches_from`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::try_get_matches_from`")]
#[doc(hidden)]
pub fn get_matches_from_safe<I, T>(self, itr: I) -> ClapResult<ArgMatches>
where
I: IntoIterator<Item = T>,
Expand All @@ -3843,6 +3861,7 @@ impl<'help> App<'help> {
since = "3.0.0",
note = "Replaced with `App::try_get_matches_from_mut`"
)]
#[doc(hidden)]
pub fn get_matches_from_safe_borrow<I, T>(&mut self, itr: I) -> ClapResult<ArgMatches>
where
I: IntoIterator<Item = T>,
Expand Down
12 changes: 12 additions & 0 deletions src/build/app_settings.rs
Expand Up @@ -342,62 +342,74 @@ pub enum AppSettings {
since = "3.0.0",
note = "Replaced with `AppSettings::AllowHyphenValues`"
)]
#[doc(hidden)]
AllowLeadingHyphen,

/// Deprecated, this is now the default, see [`AppSettings::AllowInvalidUtf8ForExternalSubcommands`] and [`ArgSettings::AllowInvalidUtf8`][crate::ArgSettings::AllowInvalidUtf8] for the opposite.
#[deprecated(
since = "3.0.0",
note = "This is now the default see `AppSettings::AllowInvalidUtf8ForExternalSubcommands` and `ArgSettings::AllowInvalidUtf8` for the opposite."
)]
#[doc(hidden)]
StrictUtf8,

/// Deprecated, this is now the default
#[deprecated(since = "3.0.0", note = "This is now the default")]
#[doc(hidden)]
UnifiedHelpMessage,

/// Deprecated, this is now the default
#[deprecated(since = "3.0.0", note = "This is now the default")]
#[doc(hidden)]
ColoredHelp,

/// Deprecated, see [`App::color`][crate::App::color]
#[deprecated(since = "3.0.0", note = "Replaced with `App::color`")]
#[doc(hidden)]
ColorAuto,

/// Deprecated, replaced with [`App::color`][crate::App::color]
#[deprecated(since = "3.0.0", note = "Replaced with `App::color`")]
#[doc(hidden)]
ColorAlways,

/// Deprecated, replaced with [`App::color`][crate::App::color]
#[deprecated(since = "3.0.0", note = "Replaced with `App::color`")]
#[doc(hidden)]
ColorNever,

/// Deprecated, replaced with [`AppSettings::DisableHelpFlag`]
#[deprecated(since = "3.0.0", note = "Replaced with `AppSettings::DisableHelpFlag`")]
#[doc(hidden)]
DisableHelpFlags,

/// Deprecated, replaced with [`AppSettings::DisableVersionFlag`]
#[deprecated(
since = "3.0.0",
note = "Replaced with `AppSettings::DisableVersionFlag`"
)]
#[doc(hidden)]
DisableVersion,

/// Deprecated, replaced with [`AppSettings::PropagateVersion`]
#[deprecated(
since = "3.0.0",
note = "Replaced with `AppSettings::PropagateVersion`"
)]
#[doc(hidden)]
GlobalVersion,

/// Deprecated, replaced with [`AppSettings::HidePossibleValues`]
#[deprecated(
since = "3.0.0",
note = "Replaced with AppSettings::HidePossibleValues"
)]
#[doc(hidden)]
HidePossibleValuesInHelp,

/// Deprecated, this is now the default
#[deprecated(since = "3.0.0", note = "This is now the default")]
#[doc(hidden)]
UnifiedHelp,

/// If the app is already built, used for caching.
Expand Down
16 changes: 16 additions & 0 deletions src/build/arg.rs
Expand Up @@ -4804,6 +4804,7 @@ impl<'help> Arg<'help> {
impl<'help> Arg<'help> {
/// Deprecated, replaced with [`Arg::new`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::new`")]
#[doc(hidden)]
pub fn with_name<S: Into<&'help str>>(n: S) -> Self {
Self::new(n)
}
Expand All @@ -4814,6 +4815,7 @@ impl<'help> Arg<'help> {
since = "3.0.0",
note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
)]
#[doc(hidden)]
pub fn from_yaml(y: &'help Yaml) -> Self {
#![allow(deprecated)]
let yaml_file_hash = y.as_hash().expect("YAML file must be a hash");
Expand Down Expand Up @@ -4883,12 +4885,14 @@ impl<'help> Arg<'help> {

/// Deprecated in [Issue #3086](https://github.com/clap-rs/clap/issues/3086), see [`arg!`][crate::arg!].
#[deprecated(since = "3.0.0", note = "Deprecated in Issue #3086, see `clap::arg!")]
#[doc(hidden)]
pub fn from_usage(u: &'help str) -> Self {
UsageParser::from_usage(u).parse()
}

/// Deprecated, replaced with [`Arg::required_unless_present`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::required_unless_present`")]
#[doc(hidden)]
#[must_use]
pub fn required_unless<T: Key>(self, arg_id: T) -> Self {
self.required_unless_present(arg_id)
Expand All @@ -4899,6 +4903,7 @@ impl<'help> Arg<'help> {
since = "3.0.0",
note = "Replaced with `Arg::required_unless_present_all`"
)]
#[doc(hidden)]
#[must_use]
pub fn required_unless_all<T, I>(self, names: I) -> Self
where
Expand All @@ -4913,6 +4918,7 @@ impl<'help> Arg<'help> {
since = "3.0.0",
note = "Replaced with `Arg::required_unless_present_any`"
)]
#[doc(hidden)]
#[must_use]
pub fn required_unless_one<T, I>(self, names: I) -> Self
where
Expand All @@ -4924,20 +4930,23 @@ impl<'help> Arg<'help> {

/// Deprecated, replaced with [`Arg::required_if_eq`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::required_if_eq`")]
#[doc(hidden)]
#[must_use]
pub fn required_if<T: Key>(self, arg_id: T, val: &'help str) -> Self {
self.required_if_eq(arg_id, val)
}

/// Deprecated, replaced with [`Arg::required_if_eq_any`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::required_if_eq_any`")]
#[doc(hidden)]
#[must_use]
pub fn required_ifs<T: Key>(self, ifs: &[(T, &'help str)]) -> Self {
self.required_if_eq_any(ifs)
}

/// Deprecated, replaced with [`Arg::hide`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide`")]
#[doc(hidden)]
#[inline]
#[must_use]
pub fn hidden(self, yes: bool) -> Self {
Expand All @@ -4946,6 +4955,7 @@ impl<'help> Arg<'help> {

/// Deprecated, replaced with [`Arg::ignore_case`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::ignore_case`")]
#[doc(hidden)]
#[inline]
#[must_use]
pub fn case_insensitive(self, yes: bool) -> Self {
Expand All @@ -4954,6 +4964,7 @@ impl<'help> Arg<'help> {

/// Deprecated, replaced with [`Arg::forbid_empty_values`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::forbid_empty_values`")]
#[doc(hidden)]
#[must_use]
pub fn empty_values(self, yes: bool) -> Self {
self.forbid_empty_values(!yes)
Expand All @@ -4965,13 +4976,15 @@ impl<'help> Arg<'help> {
since = "3.0.0",
note = "Split into `Arg::multiple_occurrences` (most likely what you want) and `Arg::multiple_values`"
)]
#[doc(hidden)]
#[must_use]
pub fn multiple(self, yes: bool) -> Self {
self.multiple_occurrences(yes).multiple_values(yes)
}

/// Deprecated, replaced with [`Arg::hide_short_help`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_short_help`")]
#[doc(hidden)]
#[inline]
#[must_use]
pub fn hidden_short_help(self, yes: bool) -> Self {
Expand All @@ -4980,6 +4993,7 @@ impl<'help> Arg<'help> {

/// Deprecated, replaced with [`Arg::hide_long_help`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_long_help`")]
#[doc(hidden)]
#[inline]
#[must_use]
pub fn hidden_long_help(self, yes: bool) -> Self {
Expand All @@ -4988,13 +5002,15 @@ impl<'help> Arg<'help> {

/// Deprecated, replaced with [`Arg::setting`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::setting`")]
#[doc(hidden)]
#[must_use]
pub fn set(self, s: ArgSettings) -> Self {
self.setting(s)
}

/// Deprecated, replaced with [`Arg::unset_setting`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::unset_setting`")]
#[doc(hidden)]
#[must_use]
pub fn unset(self, s: ArgSettings) -> Self {
self.unset_setting(s)
Expand Down
2 changes: 2 additions & 0 deletions src/build/arg_group.rs
Expand Up @@ -434,6 +434,7 @@ impl<'help> ArgGroup<'help> {

/// Deprecated, replaced with [`ArgGroup::new`]
#[deprecated(since = "3.0.0", note = "Replaced with `ArgGroup::new`")]
#[doc(hidden)]
pub fn with_name<S: Into<&'help str>>(n: S) -> Self {
Self::new(n)
}
Expand All @@ -444,6 +445,7 @@ impl<'help> ArgGroup<'help> {
since = "3.0.0",
note = "Maybe clap::Parser would fit your use case? (Issue #3087)"
)]
#[doc(hidden)]
pub fn from_yaml(yaml: &'help Yaml) -> Self {
Self::from(yaml)
}
Expand Down
3 changes: 3 additions & 0 deletions src/build/arg_settings.rs
Expand Up @@ -57,6 +57,7 @@ pub enum ArgSettings {
since = "3.0.0",
note = "Split into `ArgSettings::MultipleOccurrences` (most likely what you want) and `ArgSettings::MultipleValues`"
)]
#[doc(hidden)]
Multiple,
/// Deprecated, replaced with [`Arg::forbid_empty_values`] and
/// [`Arg::is_forbid_empty_values_set`]
Expand Down Expand Up @@ -122,6 +123,7 @@ pub enum ArgSettings {
since = "3.0.0",
note = "Replaced with `ArgSettings::AllowHyphenValues`"
)]
#[doc(hidden)]
AllowLeadingHyphen,
/// Deprecated, replaced with [`Arg::require_equals`] and [`Arg::is_require_equals_set`]
#[deprecated(
Expand Down Expand Up @@ -149,6 +151,7 @@ pub enum ArgSettings {
IgnoreCase,
/// Deprecated, replaced with [`ArgSettings::IgnoreCase`]
#[deprecated(since = "3.0.0", note = "Replaced with `ArgSettings::IgnoreCase`")]
#[doc(hidden)]
CaseInsensitive,
/// Deprecated, replaced with [`Arg::hide_env`] and [`Arg::is_hide_env_set`]
#[deprecated(
Expand Down