Merge pull request #3830 from epage/deprecate

fix: Allow people to opt-in to deprecations
This commit is contained in:
Ed Page 2022-06-14 11:07:03 -05:00 committed by GitHub
commit b619699539
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 906 additions and 402 deletions

View file

@ -38,10 +38,12 @@ Our releases fall into one of:
- Aspire to at least 6-9 months between releases
- Remove all deprecated functionality
- Try to minimize new breaking changes to ease user transition and reduce time "we go dark" (unreleased feature-branch)
- Upon release, a minor release will be made for the previous major that enables `deprecated` feature by default
- Minor releases which are for minor compatibility changes
- Aspire to at least 2 months between releases
- Changes to MSRV
- Deprecating existing functionality
- Deprecating existing functionality (behind the `deprecated` feature flag)
- Making the `deprecated` feature flag enabled-by-default (only on last planned minor release)
- `#[doc(hidden)]` all deprecated items in the prior minor release
- Patch releases
- One for every user-facing, user-contributed PR (i.e. release early, release often)
@ -51,7 +53,7 @@ If your change does not fit within a "patch" release, please coordinate with the
Some practices to avoid breaking changes
- Duplicate functionality, with old functionality marked as "deprecated"
- Common documentation pattern: `/// Deprecated in [Issue #XXX](https://github.com/clap-rs/clap/issues/XXX), replaced with [intra-doc-link]`
- Common deprecation pattern: `#[deprecated(since = "X.Y.Z", note = "Replaced with `ITEM` in Issue #XXX")]`
- Common deprecation pattern: `#[cfg_attr(feature = "deprecated", deprecated(since = "X.Y.Z", note = "Replaced with `ITEM` in Issue #XXX"))]`
- Please keep API addition and deprecation in separate commits in a PR to make it easier to review
- Develop the feature behind an `unstable-<name>` feature flag with a stablization tracking issue (e.g. [Multicall Tracking issue](https://github.com/clap-rs/clap/issues/2861))

View file

@ -73,6 +73,7 @@ color = ["atty", "termcolor"]
suggestions = ["strsim"]
# Optional
deprecated = [] # Guided experience to prepare for next breaking release (at different stages of development, this may become default)
derive = ["clap_derive", "once_cell"]
cargo = ["once_cell"] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros
wrap_help = ["terminal_size", "textwrap/terminal_size"]
@ -84,7 +85,7 @@ unicode = ["textwrap/unicode-width", "unicase"] # Support for unicode character
unstable-replace = []
unstable-grouped = []
# note: this will always enable clap_derive, change this to `clap_derive?/unstable-v4` when MSRV is bigger than 1.60
unstable-v4 = ["clap_derive/unstable-v4"]
unstable-v4 = ["clap_derive/unstable-v4", "deprecated"]
[lib]
bench = false

View file

@ -15,8 +15,8 @@ MSRV?=1.56.0
_FEATURES = minimal default wasm full debug release
_FEATURES_minimal = --no-default-features --features "std"
_FEATURES_default =
_FEATURES_wasm = --features "derive cargo env unicode yaml regex unstable-replace unstable-grouped"
_FEATURES_full = --features "derive cargo env unicode yaml regex unstable-replace unstable-grouped wrap_help"
_FEATURES_wasm = --features "deprecated derive cargo env unicode yaml regex unstable-replace unstable-grouped"
_FEATURES_full = --features "deprecated derive cargo env unicode yaml regex unstable-replace unstable-grouped wrap_help"
_FEATURES_next = ${_FEATURES_full} --features unstable-v4
_FEATURES_debug = ${_FEATURES_full} --features debug
_FEATURES_release = ${_FEATURES_full} --release

View file

@ -140,6 +140,7 @@ Why use the procedural [Builder API](https://github.com/clap-rs/clap/blob/v3.2.2
#### Optional features
* **deprecated**: Guided experience to prepare for next breaking release (at different stages of development, this may become default)
* **derive**: Enables the custom derive (i.e. `#[derive(Parser)]`). Without this you must use one of the other methods of creating a `clap` CLI listed above.
* **cargo**: Turns on macros that read values from `CARGO_*` environment variables.
* **env**: Turns on the usage of environment variables during parsing.

View file

@ -71,15 +71,21 @@ pub enum ArgAction {
/// ```
Append,
/// Deprecated, replaced with [`ArgAction::Set`] or [`ArgAction::Append`]
#[deprecated(
since = "3.2.0",
note = "Replaced with `ArgAction::Set` or `ArgAction::Append`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "Replaced with `ArgAction::Set` or `ArgAction::Append`"
)
)]
StoreValue,
/// Deprecated, replaced with [`ArgAction::SetTrue`] or [`ArgAction::Count`]
#[deprecated(
since = "3.2.0",
note = "Replaced with `ArgAction::SetTrue` or `ArgAction::Count`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "Replaced with `ArgAction::SetTrue` or `ArgAction::Count`"
)
)]
IncOccurrence,
/// When encountered, act as if `"true"` was encountered on the command-line

View file

@ -33,7 +33,10 @@ impl Default for AppFlags {
#[non_exhaustive]
pub enum AppSettings {
/// Deprecated, replaced with [`Command::ignore_errors`]
#[deprecated(since = "3.1.0", note = "Replaced with `Command::ignore_errors`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Command::ignore_errors`")
)]
IgnoreErrors,
/// Deprecated, replace
@ -67,134 +70,191 @@ pub enum AppSettings {
/// }
/// };
/// ```
#[deprecated(
since = "3.1.0",
note = "See documentation for how to hand-implement this"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "See documentation for how to hand-implement this"
)
)]
WaitOnError,
/// Deprecated, replaced with [`Command::allow_hyphen_values`] and
/// [`Arg::is_allow_hyphen_values_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::allow_hyphen_values` and `Arg::is_allow_hyphen_values_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::allow_hyphen_values` and `Arg::is_allow_hyphen_values_set`"
)
)]
AllowHyphenValues,
/// Deprecated, replaced with [`Command::allow_negative_numbers`] and
/// [`Command::is_allow_negative_numbers_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::allow_negative_numbers` and `Command::is_allow_negative_numbers_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::allow_negative_numbers` and `Command::is_allow_negative_numbers_set`"
)
)]
AllowNegativeNumbers,
/// Deprecated, replaced with [`Command::args_override_self`]
#[deprecated(since = "3.1.0", note = "Replaced with `Command::args_override_self`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Command::args_override_self`")
)]
AllArgsOverrideSelf,
/// Deprecated, replaced with [`Command::allow_missing_positional`] and
/// [`Command::is_allow_missing_positional_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::allow_missing_positional` and `Command::is_allow_missing_positional_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::allow_missing_positional` and `Command::is_allow_missing_positional_set`"
)
)]
AllowMissingPositional,
/// Deprecated, replaced with [`Command::trailing_var_arg`] and [`Command::is_trailing_var_arg_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::trailing_var_arg` and `Command::is_trailing_var_arg_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::trailing_var_arg` and `Command::is_trailing_var_arg_set`"
)
)]
TrailingVarArg,
/// Deprecated, replaced with [`Command::dont_delimit_trailing_values`] and
/// [`Command::is_dont_delimit_trailing_values_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::dont_delimit_trailing_values` and `Command::is_dont_delimit_trailing_values_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::dont_delimit_trailing_values` and `Command::is_dont_delimit_trailing_values_set`"
)
)]
DontDelimitTrailingValues,
/// Deprecated, replaced with [`Command::infer_long_args`]
#[deprecated(since = "3.1.0", note = "Replaced with `Command::infer_long_args`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Command::infer_long_args`")
)]
InferLongArgs,
/// Deprecated, replaced with [`Command::infer_subcommands`]
#[deprecated(since = "3.1.0", note = "Replaced with `Command::infer_subcommands`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Command::infer_subcommands`")
)]
InferSubcommands,
/// Deprecated, replaced with [`Command::subcommand_required`] and
/// [`Command::is_subcommand_required_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::subcommand_required` and `Command::is_subcommand_required_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::subcommand_required` and `Command::is_subcommand_required_set`"
)
)]
SubcommandRequired,
/// Deprecated, replaced with [`Command::subcommand_required`] combined with
/// [`Command::arg_required_else_help`].
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::subcommand_required` combined with `Command::arg_required_else_help`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::subcommand_required` combined with `Command::arg_required_else_help`"
)
)]
SubcommandRequiredElseHelp,
/// Deprecated, replaced with [`Command::allow_external_subcommands`] and
/// [`Command::is_allow_external_subcommands_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::allow_external_subcommands` and `Command::is_allow_external_subcommands_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::allow_external_subcommands` and `Command::is_allow_external_subcommands_set`"
)
)]
AllowExternalSubcommands,
/// Deprecated, replaced with [`Command::multicall`] and [`Command::is_multicall_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::multicall` and `Command::is_multicall_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::multicall` and `Command::is_multicall_set`"
)
)]
Multicall,
/// Deprecated, replaced with [`Command::allow_invalid_utf8_for_external_subcommands`] and [`Command::is_allow_invalid_utf8_for_external_subcommands_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::allow_invalid_utf8_for_external_subcommands` and `Command::is_allow_invalid_utf8_for_external_subcommands_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::allow_invalid_utf8_for_external_subcommands` and `Command::is_allow_invalid_utf8_for_external_subcommands_set`"
)
)]
AllowInvalidUtf8ForExternalSubcommands,
/// Deprecated, this is now the default
#[deprecated(since = "3.1.0", note = "This is now the default")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "This is now the default")
)]
UseLongFormatForHelpSubcommand,
/// Deprecated, replaced with [`Command::subcommand_negates_reqs`] and
/// [`Command::is_subcommand_negates_reqs_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::subcommand_negates_reqs` and `Command::is_subcommand_negates_reqs_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::subcommand_negates_reqs` and `Command::is_subcommand_negates_reqs_set`"
)
)]
SubcommandsNegateReqs,
/// Deprecated, replaced with [`Command::args_conflicts_with_subcommands`] and
/// [`Command::is_args_conflicts_with_subcommands_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::args_conflicts_with_subcommands` and `Command::is_args_conflicts_with_subcommands_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::args_conflicts_with_subcommands` and `Command::is_args_conflicts_with_subcommands_set`"
)
)]
ArgsNegateSubcommands,
/// Deprecated, replaced with [`Command::subcommand_precedence_over_arg`] and
/// [`Command::is_subcommand_precedence_over_arg_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::subcommand_precedence_over_arg` and `Command::is_subcommand_precedence_over_arg_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::subcommand_precedence_over_arg` and `Command::is_subcommand_precedence_over_arg_set`"
)
)]
SubcommandPrecedenceOverArg,
/// Deprecated, replaced with [`Command::arg_required_else_help`] and
/// [`Command::is_arg_required_else_help_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::arg_required_else_help` and `Command::is_arg_required_else_help_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::arg_required_else_help` and `Command::is_arg_required_else_help_set`"
)
)]
ArgRequiredElseHelp,
@ -219,160 +279,235 @@ pub enum AppSettings {
/// Deprecated, replaced with [`Command::dont_collapse_args_in_usage`] and
/// [`Command::is_dont_collapse_args_in_usage_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::dont_collapse_args_in_usage` and `Command::is_dont_collapse_args_in_usage_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::dont_collapse_args_in_usage` and `Command::is_dont_collapse_args_in_usage_set`"
)
)]
DontCollapseArgsInUsage,
/// Deprecated, replaced with [`Command::next_line_help`] and [`Command::is_next_line_help_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::next_line_help` and `Command::is_next_line_help_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::next_line_help` and `Command::is_next_line_help_set`"
)
)]
NextLineHelp,
/// Deprecated, replaced with [`Command::disable_colored_help`] and
/// [`Command::is_disable_colored_help_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::disable_colored_help` and `Command::is_disable_colored_help_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::disable_colored_help` and `Command::is_disable_colored_help_set`"
)
)]
DisableColoredHelp,
/// Deprecated, replaced with [`Command::disable_help_flag`] and [`Command::is_disable_help_flag_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::disable_help_flag` and `Command::is_disable_help_flag_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::disable_help_flag` and `Command::is_disable_help_flag_set`"
)
)]
DisableHelpFlag,
/// Deprecated, replaced with [`Command::disable_help_subcommand`] and
/// [`Command::is_disable_help_subcommand_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::disable_help_subcommand` and `Command::is_disable_help_subcommand_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::disable_help_subcommand` and `Command::is_disable_help_subcommand_set`"
)
)]
DisableHelpSubcommand,
/// Deprecated, replaced with [`Command::disable_version_flag`] and
/// [`Command::is_disable_version_flag_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::disable_version_flag` and `Command::is_disable_version_flag_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::disable_version_flag` and `Command::is_disable_version_flag_set`"
)
)]
DisableVersionFlag,
/// Deprecated, replaced with [`Command::propagate_version`] and [`Command::is_propagate_version_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::propagate_version` and `Command::is_propagate_version_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::propagate_version` and `Command::is_propagate_version_set`"
)
)]
PropagateVersion,
/// Deprecated, replaced with [`Command::hide`] and [`Command::is_hide_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::hide` and `Command::is_hide_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::hide` and `Command::is_hide_set`"
)
)]
Hidden,
/// Deprecated, replaced with [`Command::hide_possible_values`] and
/// [`Arg::is_hide_possible_values_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Command::hide_possible_values` and `Arg::is_hide_possible_values_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Command::hide_possible_values` and `Arg::is_hide_possible_values_set`"
)
)]
HidePossibleValues,
/// Deprecated, replaced with [`Command::help_expected`]
#[deprecated(since = "3.1.0", note = "Replaced with `Command::help_expected`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Command::help_expected`")
)]
HelpExpected,
/// Deprecated, replaced with [`Command::no_binary_name`]
#[deprecated(since = "3.1.0", note = "Replaced with `Command::no_binary_name`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Command::no_binary_name`")
)]
NoBinaryName,
/// Deprecated, replaced with [`Arg::action`][super::Arg::action]
#[deprecated(since = "3.2.0", note = "Replaced with `Arg::action`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `Arg::action`")
)]
NoAutoHelp,
/// Deprecated, replaced with [`Arg::action`][super::Arg::action]
#[deprecated(since = "3.2.0", note = "Replaced with `Arg::action`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `Arg::action`")
)]
NoAutoVersion,
/// Deprecated, replaced with [`AppSettings::AllowHyphenValues`]
#[deprecated(
since = "3.0.0",
note = "Replaced with `AppSettings::AllowHyphenValues`"
#[cfg_attr(
feature = "deprecated",
deprecated(
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."
#[cfg_attr(
feature = "deprecated",
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")]
#[cfg_attr(
feature = "deprecated",
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")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "This is now the default")
)]
#[doc(hidden)]
ColoredHelp,
/// Deprecated, see [`Command::color`][crate::Command::color]
#[deprecated(since = "3.0.0", note = "Replaced with `Command::color`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Command::color`")
)]
#[doc(hidden)]
ColorAuto,
/// Deprecated, replaced with [`Command::color`][crate::Command::color]
#[deprecated(since = "3.0.0", note = "Replaced with `Command::color`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Command::color`")
)]
#[doc(hidden)]
ColorAlways,
/// Deprecated, replaced with [`Command::color`][crate::Command::color]
#[deprecated(since = "3.0.0", note = "Replaced with `Command::color`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Command::color`")
)]
#[doc(hidden)]
ColorNever,
/// Deprecated, replaced with [`AppSettings::DisableHelpFlag`]
#[deprecated(since = "3.0.0", note = "Replaced with `AppSettings::DisableHelpFlag`")]
#[cfg_attr(
feature = "deprecated",
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`"
#[cfg_attr(
feature = "deprecated",
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`"
#[cfg_attr(
feature = "deprecated",
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"
#[cfg_attr(
feature = "deprecated",
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")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "This is now the default")
)]
#[doc(hidden)]
UnifiedHelp,

View file

@ -135,7 +135,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::id`]
#[deprecated(since = "3.1.0", note = "Replaced with `Arg::id`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Arg::id`")
)]
pub fn name<S: Into<&'help str>>(self, n: S) -> Self {
self.id(n)
}
@ -785,7 +788,10 @@ impl<'help> Arg<'help> {
/// Deprecated, replaced with [`Arg::action`] ([Issue #3772](https://github.com/clap-rs/clap/issues/3772))
#[inline]
#[must_use]
#[deprecated(since = "3.2.0", note = "Replaced with `Arg::action` (Issue #3772)")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `Arg::action` (Issue #3772)")
)]
pub fn multiple_occurrences(self, yes: bool) -> Self {
if yes {
self.setting(ArgSettings::MultipleOccurrences)
@ -797,9 +803,12 @@ impl<'help> Arg<'help> {
/// Deprecated, for flags this is replaced with `action(ArgAction::Count).value_parser(value_parser!(u8).range(..max))`
#[inline]
#[must_use]
#[deprecated(
since = "3.2.0",
note = "For flags, replaced with `action(ArgAction::Count).value_parser(value_parser!(u8).range(..max))`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "For flags, replaced with `action(ArgAction::Count).value_parser(value_parser!(u8).range(..max))`"
)
)]
pub fn max_occurrences(mut self, qty: usize) -> Self {
self.max_occurs = Some(qty);
@ -1509,7 +1518,10 @@ impl<'help> Arg<'help> {
/// Deprecated, replaced with [`Arg::value_parser(...)`]
#[inline]
#[must_use]
#[deprecated(since = "3.2.0", note = "Replaced with `Arg::value_parser(...)`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `Arg::value_parser(...)`")
)]
pub fn validator<F, O, E>(mut self, mut f: F) -> Self
where
F: FnMut(&str) -> Result<O, E> + Send + 'help,
@ -1523,7 +1535,10 @@ impl<'help> Arg<'help> {
/// Deprecated, replaced with [`Arg::value_parser(...)`]
#[must_use]
#[deprecated(since = "3.2.0", note = "Replaced with `Arg::value_parser(...)`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `Arg::value_parser(...)`")
)]
pub fn validator_os<F, O, E>(mut self, mut f: F) -> Self
where
F: FnMut(&OsStr) -> Result<O, E> + Send + 'help,
@ -1536,9 +1551,12 @@ impl<'help> Arg<'help> {
}
/// Deprecated in [Issue #3743](https://github.com/clap-rs/clap/issues/3743), replaced with [`Arg::value_parser(...)`]
#[deprecated(
since = "3.2.0",
note = "Deprecated in Issue #3743; eplaced with `Arg::value_parser(...)`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "Deprecated in Issue #3743; eplaced with `Arg::value_parser(...)`"
)
)]
#[cfg(feature = "regex")]
#[must_use]
@ -1558,9 +1576,12 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::value_parser(PossibleValuesParser::new(...))`]
#[deprecated(
since = "3.2.0",
note = "Replaced with `Arg::value_parser(PossibleValuesParser::new(...)).takes_value(true)`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "Replaced with `Arg::value_parser(PossibleValuesParser::new(...)).takes_value(true)`"
)
)]
#[must_use]
pub fn possible_value<T>(mut self, value: T) -> Self
@ -1572,9 +1593,12 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::value_parser(PossibleValuesParser::new(...))`]
#[deprecated(
since = "3.2.0",
note = "Replaced with `Arg::value_parser(PossibleValuesParser::new(...)).takes_value(true)`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "Replaced with `Arg::value_parser(PossibleValuesParser::new(...)).takes_value(true)`"
)
)]
#[must_use]
pub fn possible_values<I, T>(mut self, values: I) -> Self
@ -1709,9 +1733,12 @@ impl<'help> Arg<'help> {
/// or [`ValueParser::path_buf()`][crate::builder::ValueParser::path_buf]
#[inline]
#[must_use]
#[deprecated(
since = "3.2.0",
note = "Replaced with `Arg::value_parser(...)` with either `ValueParser::os_string()` or `ValueParser::path_buf()`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "Replaced with `Arg::value_parser(...)` with either `ValueParser::os_string()` or `ValueParser::path_buf()`"
)
)]
pub fn allow_invalid_utf8(self, yes: bool) -> Self {
if yes {
@ -1724,9 +1751,12 @@ impl<'help> Arg<'help> {
/// Deprecated, replaced with [`Arg::value_parser(NonEmptyStringValueParser::new())`]
#[inline]
#[must_use]
#[deprecated(
since = "3.2.0",
note = "Replaced with `Arg::value_parser(NonEmptyStringValueParser::new())`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "Replaced with `Arg::value_parser(NonEmptyStringValueParser::new())`"
)
)]
pub fn forbid_empty_values(self, yes: bool) -> Self {
if yes {
@ -1853,7 +1883,10 @@ impl<'help> Arg<'help> {
/// Deprecated, replaced with [`Arg::use_value_delimiter`]
#[inline]
#[must_use]
#[deprecated(since = "3.1.0", note = "Replaced with `Arg::use_value_delimiter`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Arg::use_value_delimiter`")
)]
pub fn use_delimiter(self, yes: bool) -> Self {
self.use_value_delimiter(yes)
}
@ -1977,7 +2010,10 @@ impl<'help> Arg<'help> {
/// Deprecated, replaced with [`Arg::require_value_delimiter`]
#[inline]
#[must_use]
#[deprecated(since = "3.1.0", note = "Replaced with `Arg::require_value_delimiter`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Arg::require_value_delimiter`")
)]
pub fn require_delimiter(self, yes: bool) -> Self {
self.require_value_delimiter(yes)
}
@ -4203,7 +4239,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::get_id`]
#[deprecated(since = "3.1.0", note = "Replaced with `Arg::get_id`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Arg::get_id`")
)]
pub fn get_name(&self) -> &'help str {
self.get_id()
}
@ -4306,9 +4345,12 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::get_value_parser().possible_values()`]
#[deprecated(
since = "3.2.0",
note = "Replaced with `Arg::get_value_parser().possible_values()`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "Replaced with `Arg::get_value_parser().possible_values()`"
)
)]
pub fn get_possible_values(&self) -> Option<&[PossibleValue<'help>]> {
if self.possible_vals.is_empty() {
@ -4379,7 +4421,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::is_global_set`]
#[deprecated(since = "3.1.0", note = "Replaced with `Arg::is_global_set`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Arg::is_global_set`")
)]
pub fn get_global(&self) -> bool {
self.is_global_set()
}
@ -4439,7 +4484,10 @@ impl<'help> Arg<'help> {
}
/// [`Arg::multiple_occurrences`] is going away ([Issue #3772](https://github.com/clap-rs/clap/issues/3772))
#[deprecated(since = "3.2.0", note = "`multiple_occurrences` away (Issue #3772)")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "`multiple_occurrences` away (Issue #3772)")
)]
pub fn is_multiple_occurrences_set(&self) -> bool {
self.is_set(ArgSettings::MultipleOccurrences)
}
@ -4455,13 +4503,19 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::get_value_parser()`]
#[deprecated(since = "3.2.0", note = "Replaced with `Arg::get_value_parser()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `Arg::get_value_parser()`")
)]
pub fn is_forbid_empty_values_set(&self) -> bool {
self.is_set(ArgSettings::ForbidEmptyValues)
}
/// Deprecated, replaced with [`Arg::get_value_parser()`
#[deprecated(since = "3.2.0", note = "Replaced with `Arg::get_value_parser()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `Arg::get_value_parser()`")
)]
pub fn is_allow_invalid_utf8_set(&self) -> bool {
self.is_set(ArgSettings::AllowInvalidUtf8)
}
@ -4580,7 +4634,10 @@ impl<'help> Arg<'help> {
/// # Deprecated
impl<'help> Arg<'help> {
/// Deprecated, replaced with [`Arg::new`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::new`")]
#[cfg_attr(
feature = "deprecated",
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)
@ -4588,9 +4645,12 @@ impl<'help> Arg<'help> {
/// Deprecated in [Issue #3087](https://github.com/clap-rs/clap/issues/3087), maybe [`clap::Parser`][crate::Parser] would fit your use case?
#[cfg(feature = "yaml")]
#[deprecated(
since = "3.0.0",
note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
#[cfg_attr(
feature = "deprecated",
deprecated(
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 {
@ -4661,14 +4721,20 @@ 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!")]
#[cfg_attr(
feature = "deprecated",
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`")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -4676,9 +4742,12 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::required_unless_present_all`]
#[deprecated(
since = "3.0.0",
note = "Replaced with `Arg::required_unless_present_all`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "Replaced with `Arg::required_unless_present_all`"
)
)]
#[doc(hidden)]
#[must_use]
@ -4691,9 +4760,12 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::required_unless_present_any`]
#[deprecated(
since = "3.0.0",
note = "Replaced with `Arg::required_unless_present_any`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "Replaced with `Arg::required_unless_present_any`"
)
)]
#[doc(hidden)]
#[must_use]
@ -4706,7 +4778,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::required_if_eq`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::required_if_eq`")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -4714,7 +4789,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::required_if_eq_any`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::required_if_eq_any`")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -4722,7 +4800,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::hide`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Arg::hide`")
)]
#[doc(hidden)]
#[inline]
#[must_use]
@ -4731,7 +4812,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::ignore_case`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::ignore_case`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Arg::ignore_case`")
)]
#[doc(hidden)]
#[inline]
#[must_use]
@ -4740,7 +4824,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::forbid_empty_values`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::forbid_empty_values`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Arg::forbid_empty_values`")
)]
#[doc(hidden)]
#[must_use]
pub fn empty_values(self, yes: bool) -> Self {
@ -4749,9 +4836,12 @@ impl<'help> Arg<'help> {
/// Deprecated, replaced with [`Arg::multiple_occurrences`] (most likely what you want) and
/// [`Arg::multiple_values`]
#[deprecated(
since = "3.0.0",
note = "Split into `Arg::multiple_occurrences` (most likely what you want) and `Arg::multiple_values`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "Split into `Arg::multiple_occurrences` (most likely what you want) and `Arg::multiple_values`"
)
)]
#[doc(hidden)]
#[must_use]
@ -4760,7 +4850,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::hide_short_help`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_short_help`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_short_help`")
)]
#[doc(hidden)]
#[inline]
#[must_use]
@ -4769,7 +4862,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::hide_long_help`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_long_help`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_long_help`")
)]
#[doc(hidden)]
#[inline]
#[must_use]
@ -4778,7 +4874,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::setting`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::setting`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Arg::setting`")
)]
#[doc(hidden)]
#[must_use]
pub fn set(self, s: ArgSettings) -> Self {
@ -4786,7 +4885,10 @@ impl<'help> Arg<'help> {
}
/// Deprecated, replaced with [`Arg::unset_setting`]
#[deprecated(since = "3.0.0", note = "Replaced with `Arg::unset_setting`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Arg::unset_setting`")
)]
#[doc(hidden)]
#[must_use]
pub fn unset(self, s: ArgSettings) -> Self {

View file

@ -129,7 +129,10 @@ impl<'help> ArgGroup<'help> {
}
/// Deprecated, replaced with [`ArgGroup::id`]
#[deprecated(since = "3.1.0", note = "Replaced with `ArgGroup::id`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `ArgGroup::id`")
)]
pub fn name<S: Into<&'help str>>(self, n: S) -> Self {
self.id(n)
}
@ -433,7 +436,10 @@ impl<'help> ArgGroup<'help> {
}
/// Deprecated, replaced with [`ArgGroup::new`]
#[deprecated(since = "3.0.0", note = "Replaced with `ArgGroup::new`")]
#[cfg_attr(
feature = "deprecated",
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)
@ -441,9 +447,12 @@ impl<'help> ArgGroup<'help> {
/// Deprecated in [Issue #3087](https://github.com/clap-rs/clap/issues/3087), maybe [`clap::Parser`][crate::Parser] would fit your use case?
#[cfg(feature = "yaml")]
#[deprecated(
since = "3.0.0",
note = "Maybe clap::Parser would fit your use case? (Issue #3087)"
#[cfg_attr(
feature = "deprecated",
deprecated(
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 {

View file

@ -33,162 +33,237 @@ impl Default for ArgFlags {
#[non_exhaustive]
pub enum ArgSettings {
/// Deprecated, replaced with [`Arg::required`] and [`Arg::is_required_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::required` and `Arg::is_required_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::required` and `Arg::is_required_set`"
)
)]
Required,
/// Deprecated, replaced with [`Arg::multiple_values`] and [`Arg::is_multiple_values_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::multiple_values` and `Arg::`is_multiple_values_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::multiple_values` and `Arg::`is_multiple_values_set`"
)
)]
MultipleValues,
/// Deprecated, replaced with [`Arg::multiple_occurrences`] and
/// [`Arg::is_multiple_occurrences_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::multiple_occurrences` and `Arg::is_multiple_occurrences_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::multiple_occurrences` and `Arg::is_multiple_occurrences_set`"
)
)]
MultipleOccurrences,
/// Deprecated, see [`ArgSettings::MultipleOccurrences`] (most likely what you want) and
/// [`ArgSettings::MultipleValues`]
#[deprecated(
since = "3.0.0",
note = "Split into `ArgSettings::MultipleOccurrences` (most likely what you want) and `ArgSettings::MultipleValues`"
#[cfg_attr(
feature = "deprecated",
deprecated(
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`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::forbid_empty_values` and `Arg::is_forbid_empty_values_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::forbid_empty_values` and `Arg::is_forbid_empty_values_set`"
)
)]
ForbidEmptyValues,
/// Deprecated, replaced with [`Arg::global`] and [`Arg::is_global_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::global` and `Arg::is_global_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::global` and `Arg::is_global_set`"
)
)]
Global,
/// Deprecated, replaced with [`Arg::hide`] and [`Arg::is_hide_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide` and `Arg::is_hide_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide` and `Arg::is_hide_set`"
)
)]
Hidden,
/// Deprecated, replaced with [`Arg::takes_value`] and [`Arg::is_takes_value_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::takes_value` and `Arg::is_takes_value_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::takes_value` and `Arg::is_takes_value_set`"
)
)]
TakesValue,
/// Deprecated, replaced with [`Arg::use_value_delimiter`] and
/// [`Arg::is_use_value_delimiter_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::use_value_delimiter` and `Arg::is_use_value_delimiter_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::use_value_delimiter` and `Arg::is_use_value_delimiter_set`"
)
)]
UseValueDelimiter,
/// Deprecated, replaced with [`Arg::next_line_help`] and [`Arg::is_next_line_help_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::next_line_help` and `Arg::is_next_line_help_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::next_line_help` and `Arg::is_next_line_help_set`"
)
)]
NextLineHelp,
/// Deprecated, replaced with [`Arg::require_value_delimiter`] and
/// [`Arg::is_require_value_delimiter_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::require_value_delimiter` and `Arg::is_require_value_delimiter_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::require_value_delimiter` and `Arg::is_require_value_delimiter_set`"
)
)]
RequireDelimiter,
/// Deprecated, replaced with [`Arg::hide_possible_values`] and
/// [`Arg::is_hide_possible_values_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_possible_values` and `Arg::is_hide_possible_values_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_possible_values` and `Arg::is_hide_possible_values_set`"
)
)]
HidePossibleValues,
/// Deprecated, replaced with [`Arg::allow_hyphen_values`] and
/// [`Arg::is_allow_hyphen_values_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::allow_hyphen_values` and `Arg::is_allow_hyphen_values_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::allow_hyphen_values` and `Arg::is_allow_hyphen_values_set`"
)
)]
AllowHyphenValues,
/// Deprecated, replaced with [`ArgSettings::AllowHyphenValues`]
#[deprecated(
since = "3.0.0",
note = "Replaced with `ArgSettings::AllowHyphenValues`"
#[cfg_attr(
feature = "deprecated",
deprecated(
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(
since = "3.1.0",
note = "Replaced with `Arg::require_equals` and `Arg::is_require_equals_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::require_equals` and `Arg::is_require_equals_set`"
)
)]
RequireEquals,
/// Deprecated, replaced with [`Arg::last`] and [`Arg::is_last_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::last` and `Arg::is_last_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::last` and `Arg::is_last_set`"
)
)]
Last,
/// Deprecated, replaced with [`Arg::hide_default_value`] and [`Arg::is_hide_default_value_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_default_value` and `Arg::is_hide_default_value_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_default_value` and `Arg::is_hide_default_value_set`"
)
)]
HideDefaultValue,
/// Deprecated, replaced with [`Arg::ignore_case`] and [`Arg::is_ignore_case_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::ignore_case` and `Arg::is_ignore_case_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::ignore_case` and `Arg::is_ignore_case_set`"
)
)]
IgnoreCase,
/// Deprecated, replaced with [`ArgSettings::IgnoreCase`]
#[deprecated(since = "3.0.0", note = "Replaced with `ArgSettings::IgnoreCase`")]
#[cfg_attr(
feature = "deprecated",
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(
since = "3.1.0",
note = "Replaced with `Arg::hide_env` and `Arg::is_hide_env_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_env` and `Arg::is_hide_env_set`"
)
)]
#[cfg(feature = "env")]
HideEnv,
/// Deprecated, replaced with [`Arg::hide_env_values`] and [`Arg::is_hide_env_values_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_env_values` and `Arg::is_hide_env_values_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_env_values` and `Arg::is_hide_env_values_set`"
)
)]
#[cfg(feature = "env")]
HideEnvValues,
/// Deprecated, replaced with [`Arg::hide_short_help`] and [`Arg::is_hide_short_help_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_short_help` and `Arg::is_hide_short_help_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_short_help` and `Arg::is_hide_short_help_set`"
)
)]
HiddenShortHelp,
/// Deprecated, replaced with [`Arg::hide_long_help`] and [`Arg::is_hide_long_help_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_long_help` and `Arg::is_hide_long_help_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::hide_long_help` and `Arg::is_hide_long_help_set`"
)
)]
HiddenLongHelp,
/// Deprecated, replaced with [`Arg::allow_invalid_utf8`] and [`Arg::is_allow_invalid_utf8_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::allow_invalid_utf8` and `Arg::is_allow_invalid_utf8_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::allow_invalid_utf8` and `Arg::is_allow_invalid_utf8_set`"
)
)]
AllowInvalidUtf8,
/// Deprecated, replaced with [`Arg::exclusive`] and [`Arg::is_exclusive_set`]
#[deprecated(
since = "3.1.0",
note = "Replaced with `Arg::exclusive` and `Arg::is_exclusive_set`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `Arg::exclusive` and `Arg::is_exclusive_set`"
)
)]
Exclusive,
}

View file

@ -70,7 +70,10 @@ use crate::builder::debug_asserts::assert_app;
pub type Command<'help> = App<'help>;
/// Deprecated, replaced with [`Command`]
#[deprecated(since = "3.1.0", note = "Replaced with `Command`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Command`")
)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct App<'help> {
id: Id,
@ -912,7 +915,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`ArgAction::Set`][super::ArgAction::Set]
#[deprecated(since = "3.2.0", note = "Replaced with `Arg::action(ArgAction::Set)`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `Arg::action(ArgAction::Set)`")
)]
pub fn args_override_self(self, yes: bool) -> Self {
if yes {
self.global_setting(AppSettings::AllArgsOverrideSelf)
@ -1808,7 +1814,10 @@ impl<'help> App<'help> {
/// Deprecated, replaced with [`Command::next_help_heading`]
#[inline]
#[must_use]
#[deprecated(since = "3.1.0", note = "Replaced with `App::next_help_heading`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `App::next_help_heading`")
)]
pub fn help_heading<O>(self, heading: O) -> Self
where
O: Into<Option<&'help str>>,
@ -3284,7 +3293,10 @@ impl<'help> App<'help> {
/// Deprecated, replaced with [`Command::get_next_help_heading`]
#[inline]
#[deprecated(since = "3.1.0", note = "Replaced with `App::get_next_help_heading`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `App::get_next_help_heading`")
)]
pub fn get_help_heading(&self) -> Option<&'help str> {
self.get_next_help_heading()
}
@ -3398,9 +3410,12 @@ impl<'help> App<'help> {
/// Deprecated, replaced with [`App::get_subcommand_help_heading`]
#[inline]
#[deprecated(
since = "3.1.0",
note = "Replaced with `App::get_subcommand_help_heading`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `App::get_subcommand_help_heading`"
)
)]
pub fn get_subommand_help_heading(&self) -> Option<&str> {
self.get_subcommand_help_heading()
@ -3722,9 +3737,12 @@ impl<'help> App<'help> {
impl<'help> App<'help> {
/// Deprecated in [Issue #3087](https://github.com/clap-rs/clap/issues/3087), maybe [`clap::Parser`][crate::Parser] would fit your use case?
#[cfg(feature = "yaml")]
#[deprecated(
since = "3.0.0",
note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
#[cfg_attr(
feature = "deprecated",
deprecated(
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 {
@ -3813,7 +3831,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::override_usage`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::override_usage`")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -3821,7 +3842,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::override_help`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::override_help`")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -3829,7 +3853,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::mut_arg`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`")
)]
#[doc(hidden)]
#[must_use]
pub fn help_short(self, c: char) -> Self {
@ -3837,7 +3864,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::mut_arg`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`")
)]
#[doc(hidden)]
#[must_use]
pub fn version_short(self, c: char) -> Self {
@ -3845,7 +3875,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::mut_arg`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -3853,7 +3886,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::mut_arg`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::mut_arg`")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -3861,7 +3897,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::help_template`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::help_template`")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -3869,7 +3908,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::setting(a| b)`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::setting(a | b)`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `App::setting(a | b)`")
)]
#[doc(hidden)]
#[must_use]
pub fn settings(mut self, settings: &[AppSettings]) -> Self {
@ -3880,7 +3922,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::unset_setting(a| b)`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::unset_setting(a | b)`")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -3891,7 +3936,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::global_setting(a| b)`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::global_setting(a | b)`")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -3903,7 +3951,10 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::term_width`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::term_width`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `App::term_width`")
)]
#[doc(hidden)]
#[must_use]
pub fn set_term_width(self, width: usize) -> Self {
@ -3911,7 +3962,10 @@ 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!")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -3920,7 +3974,10 @@ 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!")]
#[cfg_attr(
feature = "deprecated",
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 {
@ -3936,28 +3993,40 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::render_version`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::render_version`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `App::render_version`")
)]
#[doc(hidden)]
pub fn write_version<W: io::Write>(&self, w: &mut W) -> ClapResult<()> {
write!(w, "{}", self.render_version()).map_err(From::from)
}
/// Deprecated, replaced with [`Command::render_long_version`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::render_long_version`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `App::render_long_version`")
)]
#[doc(hidden)]
pub fn write_long_version<W: io::Write>(&self, w: &mut W) -> ClapResult<()> {
write!(w, "{}", self.render_long_version()).map_err(From::from)
}
/// Deprecated, replaced with [`Command::try_get_matches`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::try_get_matches`")]
#[cfg_attr(
feature = "deprecated",
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 [`Command::try_get_matches_from`]
#[deprecated(since = "3.0.0", note = "Replaced with `App::try_get_matches_from`")]
#[cfg_attr(
feature = "deprecated",
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
@ -3968,9 +4037,12 @@ impl<'help> App<'help> {
}
/// Deprecated, replaced with [`Command::try_get_matches_from_mut`]
#[deprecated(
since = "3.0.0",
note = "Replaced with `App::try_get_matches_from_mut`"
#[cfg_attr(
feature = "deprecated",
deprecated(
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>
@ -4062,19 +4134,28 @@ impl<'help> App<'help> {
}
#[doc(hidden)]
#[deprecated(since = "3.1.10", note = "Replaced with `Command::build`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.10", note = "Replaced with `Command::build`")
)]
pub fn _build_all(&mut self) {
self.build();
}
#[doc(hidden)]
#[deprecated(since = "3.1.10", note = "Replaced with `Command::build`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.10", note = "Replaced with `Command::build`")
)]
pub fn _build(&mut self) {
self._build_self()
}
#[doc(hidden)]
#[deprecated(since = "3.1.13", note = "Replaced with `Command::build`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.13", note = "Replaced with `Command::build`")
)]
pub fn _build_bin_names(&mut self) {
self._build_bin_names_internal();
}

View file

@ -164,7 +164,10 @@ impl<'help> PossibleValue<'help> {
/// Deprecated, replaced with [`PossibleValue::is_hide_set`]
#[inline]
#[deprecated(since = "3.1.0", note = "Replaced with `PossibleValue::is_hide_set`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `PossibleValue::is_hide_set`")
)]
pub fn is_hidden(&self) -> bool {
self.is_hide_set()
}
@ -181,9 +184,12 @@ impl<'help> PossibleValue<'help> {
}
/// Get the name if argument value is not hidden, `None` otherwise
#[deprecated(
since = "3.1.4",
note = "Use `PossibleValue::is_hide_set` and `PossibleValue::get_name`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.4",
note = "Use `PossibleValue::is_hide_set` and `PossibleValue::get_name`"
)
)]
pub fn get_visible_name(&self) -> Option<&'help str> {
if self.hide {

View file

@ -158,9 +158,12 @@ pub trait Parser: FromArgMatches + CommandFactory + Sized {
/// Deprecated, `StructOpt::clap` replaced with [`IntoCommand::command`] (derive as part of
/// [`Parser`])
#[deprecated(
since = "3.0.0",
note = "`StructOpt::clap` is replaced with `IntoCommand::command` (derived as part of `Parser`)"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "`StructOpt::clap` is replaced with `IntoCommand::command` (derived as part of `Parser`)"
)
)]
#[doc(hidden)]
fn clap<'help>() -> Command<'help> {
@ -169,9 +172,12 @@ pub trait Parser: FromArgMatches + CommandFactory + Sized {
/// Deprecated, `StructOpt::from_clap` replaced with [`FromArgMatches::from_arg_matches_mut`] (derive as part of
/// [`Parser`])
#[deprecated(
since = "3.0.0",
note = "`StructOpt::from_clap` is replaced with `FromArgMatches::from_arg_matches_mut` (derived as part of `Parser`)"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "`StructOpt::from_clap` is replaced with `FromArgMatches::from_arg_matches_mut` (derived as part of `Parser`)"
)
)]
#[doc(hidden)]
fn from_clap(matches: &ArgMatches) -> Self {
@ -179,9 +185,12 @@ pub trait Parser: FromArgMatches + CommandFactory + Sized {
}
/// Deprecated, `StructOpt::from_args` replaced with `Parser::parse` (note the change in derives)
#[deprecated(
since = "3.0.0",
note = "`StructOpt::from_args` is replaced with `Parser::parse` (note the change in derives)"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "`StructOpt::from_args` is replaced with `Parser::parse` (note the change in derives)"
)
)]
#[doc(hidden)]
fn from_args() -> Self {
@ -189,9 +198,12 @@ pub trait Parser: FromArgMatches + CommandFactory + Sized {
}
/// Deprecated, `StructOpt::from_args_safe` replaced with `Parser::try_parse` (note the change in derives)
#[deprecated(
since = "3.0.0",
note = "`StructOpt::from_args_safe` is replaced with `Parser::try_parse` (note the change in derives)"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "`StructOpt::from_args_safe` is replaced with `Parser::try_parse` (note the change in derives)"
)
)]
#[doc(hidden)]
fn from_args_safe() -> Result<Self, Error> {
@ -199,9 +211,12 @@ pub trait Parser: FromArgMatches + CommandFactory + Sized {
}
/// Deprecated, `StructOpt::from_iter` replaced with `Parser::parse_from` (note the change in derives)
#[deprecated(
since = "3.0.0",
note = "`StructOpt::from_iter` is replaced with `Parser::parse_from` (note the change in derives)"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "`StructOpt::from_iter` is replaced with `Parser::parse_from` (note the change in derives)"
)
)]
#[doc(hidden)]
fn from_iter<I, T>(itr: I) -> Self
@ -214,9 +229,12 @@ pub trait Parser: FromArgMatches + CommandFactory + Sized {
/// Deprecated, `StructOpt::from_iter_safe` replaced with `Parser::try_parse_from` (note the
/// change in derives)
#[deprecated(
since = "3.0.0",
note = "`StructOpt::from_iter_safe` is replaced with `Parser::try_parse_from` (note the change in derives)"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "`StructOpt::from_iter_safe` is replaced with `Parser::try_parse_from` (note the change in derives)"
)
)]
#[doc(hidden)]
fn from_iter_safe<I, T>(itr: I) -> Result<Self, Error>
@ -240,7 +258,10 @@ pub trait CommandFactory: Sized {
Self::into_app()
}
/// Deprecated, replaced with `CommandFactory::command`
#[deprecated(since = "3.1.0", note = "Replaced with `CommandFactory::command")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `CommandFactory::command")
)]
fn into_app<'help>() -> Command<'help>;
/// Build a [`Command`] that can update `self`.
///
@ -250,9 +271,12 @@ pub trait CommandFactory: Sized {
Self::into_app_for_update()
}
/// Deprecated, replaced with `CommandFactory::command_for_update`
#[deprecated(
since = "3.1.0",
note = "Replaced with `CommandFactory::command_for_update"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.1.0",
note = "Replaced with `CommandFactory::command_for_update"
)
)]
fn into_app_for_update<'help>() -> Command<'help>;
}

View file

@ -40,10 +40,16 @@ pub type Result<T, E = Error> = StdResult<T, E>;
pub struct Error {
inner: Box<ErrorInner>,
/// Deprecated, replaced with [`Error::kind()`]
#[deprecated(since = "3.1.0", note = "Replaced with `Error::kind()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Error::kind()`")
)]
pub kind: ErrorKind,
/// Deprecated, replaced with [`Error::context()`]
#[deprecated(since = "3.1.0", note = "Replaced with `Error::context()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `Error::context()`")
)]
pub info: Vec<String>,
}
@ -153,7 +159,10 @@ impl Error {
/// Deprecated, replaced with [`Command::error`]
///
/// [`Command::error`]: crate::Command::error
#[deprecated(since = "3.0.0", note = "Replaced with `Command::error`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Command::error`")
)]
#[doc(hidden)]
pub fn with_description(description: String, kind: ErrorKind) -> Self {
Error::raw(kind, description)

View file

@ -48,9 +48,12 @@ pub use crate::parser::{Indices, OsValues, ValueSource, Values};
#[cfg(feature = "yaml")]
#[doc(hidden)]
#[deprecated(
since = "3.0.0",
note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
)
)]
#[doc(hidden)]
pub use yaml_rust::YamlLoader;
@ -60,14 +63,23 @@ pub use yaml_rust::YamlLoader;
pub use clap_derive::{self, *};
/// Deprecated, replaced with [`CommandFactory`]
#[deprecated(since = "3.0.0", note = "Replaced with `CommandFactory`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `CommandFactory`")
)]
pub use CommandFactory as IntoApp;
/// Deprecated, replaced with [`Parser`]
#[deprecated(since = "3.0.0", note = "Replaced with `Parser`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Parser`")
)]
#[doc(hidden)]
pub use Parser as StructOpt;
/// Deprecated, replaced with [`ValueEnum`]
#[deprecated(since = "3.2.0", note = "Replaced with `ValueEnum`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ValueEnum`")
)]
pub use ValueEnum as ArgEnum;
#[cfg(any(feature = "derive", feature = "cargo"))]
@ -96,9 +108,12 @@ const INTERNAL_ERROR_MSG: &str = "Fatal internal error. Please consider filing a
const INVALID_UTF8: &str = "unexpected invalid UTF-8 code point";
/// Deprecated, replaced with [`Command::new`], unless you were looking for [Subcommand]
#[deprecated(
since = "3.0.0",
note = "Replaced with `Command::new` unless you intended the `Subcommand` trait"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "Replaced with `Command::new` unless you intended the `Subcommand` trait"
)
)]
#[doc(hidden)]
#[derive(Debug, Copy, Clone)]
@ -108,7 +123,10 @@ pub struct SubCommand {}
impl SubCommand {
/// Deprecated, replaced with [`Command::new`].
/// Did you mean Subcommand (lower-case c)?
#[deprecated(since = "3.0.0", note = "Replaced with `Command::new`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `Command::new`")
)]
#[doc(hidden)]
pub fn with_name<'help>(name: &str) -> App<'help> {
Command::new(name)
@ -116,9 +134,12 @@ impl SubCommand {
/// Deprecated in [Issue #3087](https://github.com/clap-rs/clap/issues/3087), maybe [`clap::Parser`][crate::Parser] would fit your use case?
#[cfg(feature = "yaml")]
#[deprecated(
since = "3.0.0",
note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
)
)]
#[doc(hidden)]
pub fn from_yaml(yaml: &yaml_rust::Yaml) -> App {

View file

@ -1,8 +1,11 @@
/// Deprecated in [Issue #3087](https://github.com/clap-rs/clap/issues/3087), maybe [`clap::Parser`][crate::Parser] would fit your use case?
#[cfg(feature = "yaml")]
#[deprecated(
since = "3.0.0",
note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
)
)]
#[doc(hidden)]
#[macro_export]
@ -15,7 +18,10 @@ macro_rules! load_yaml {
/// Deprecated, replaced with [`ArgMatches::value_of_t`][crate::ArgMatches::value_of_t]
#[macro_export]
#[deprecated(since = "3.0.0", note = "Replaced with `ArgMatches::value_of_t`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `ArgMatches::value_of_t`")
)]
#[doc(hidden)]
macro_rules! value_t {
($m:ident, $v:expr, $t:ty) => {
@ -28,9 +34,12 @@ macro_rules! value_t {
/// Deprecated, replaced with [`ArgMatches::value_of_t_or_exit`][crate::ArgMatches::value_of_t_or_exit]
#[macro_export]
#[deprecated(
since = "3.0.0",
note = "Replaced with `ArgMatches::value_of_t_or_exit`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "Replaced with `ArgMatches::value_of_t_or_exit`"
)
)]
#[doc(hidden)]
macro_rules! value_t_or_exit {
@ -44,7 +53,10 @@ macro_rules! value_t_or_exit {
/// Deprecated, replaced with [`ArgMatches::values_of_t`][crate::ArgMatches::value_of_t]
#[macro_export]
#[deprecated(since = "3.0.0", note = "Replaced with `ArgMatches::values_of_t`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `ArgMatches::values_of_t`")
)]
#[doc(hidden)]
macro_rules! values_t {
($m:ident, $v:expr, $t:ty) => {
@ -57,9 +69,12 @@ macro_rules! values_t {
/// Deprecated, replaced with [`ArgMatches::values_of_t_or_exit`][crate::ArgMatches::value_of_t_or_exit]
#[macro_export]
#[deprecated(
since = "3.0.0",
note = "Replaced with `ArgMatches::values_of_t_or_exit`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "Replaced with `ArgMatches::values_of_t_or_exit`"
)
)]
#[doc(hidden)]
macro_rules! values_t_or_exit {
@ -71,7 +86,10 @@ macro_rules! values_t_or_exit {
};
}
#[deprecated(since = "3.0.0", note = "Replaced with `ArgEnum`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `ArgEnum`")
)]
#[doc(hidden)]
#[macro_export]
macro_rules! _clap_count_exprs {
@ -81,7 +99,10 @@ macro_rules! _clap_count_exprs {
}
/// Deprecated, replaced with [`ArgEnum`][crate::ArgEnum]
#[deprecated(since = "3.0.0", note = "Replaced with `ArgEnum`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.0.0", note = "Replaced with `ArgEnum`")
)]
#[doc(hidden)]
#[macro_export]
macro_rules! arg_enum {
@ -344,7 +365,10 @@ macro_rules! command {
/// Deprecated, replaced with [`clap::command!`][crate::command]
#[cfg(feature = "cargo")]
#[deprecated(since = "3.1.0", note = "Replaced with `clap::command!")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.1.0", note = "Replaced with `clap::command!")
)]
#[macro_export]
macro_rules! app_from_crate {
() => {{
@ -754,9 +778,12 @@ macro_rules! arg {
}
/// Deprecated, replaced with [`clap::Parser`][crate::Parser] and [`clap::arg!`][crate::arg] (Issue clap-rs/clap#2835)
#[deprecated(
since = "3.0.0",
note = "Replaced with `clap::Parser` for a declarative API (Issue clap-rs/clap#2835)"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.0.0",
note = "Replaced with `clap::Parser` for a declarative API (Issue clap-rs/clap#2835)"
)
)]
#[doc(hidden)]
#[macro_export]

View file

@ -342,7 +342,10 @@ impl ArgMatches {
}
/// Deprecated, replaced with [`ArgMatches::get_one()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_one()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_one()`")
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn value_of<T: Key>(&self, id: T) -> Option<&str> {
let id = Id::from(id);
@ -352,7 +355,10 @@ impl ArgMatches {
}
/// Deprecated, replaced with [`ArgMatches::get_one()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_one()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_one()`")
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn value_of_lossy<T: Key>(&self, id: T) -> Option<Cow<'_, str>> {
let id = Id::from(id);
@ -362,7 +368,10 @@ impl ArgMatches {
}
/// Deprecated, replaced with [`ArgMatches::get_one()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_one()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_one()`")
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn value_of_os<T: Key>(&self, id: T) -> Option<&OsStr> {
let id = Id::from(id);
@ -372,7 +381,10 @@ impl ArgMatches {
}
/// Deprecated, replaced with [`ArgMatches::get_many()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn values_of<T: Key>(&self, id: T) -> Option<Values> {
#![allow(deprecated)]
@ -431,7 +443,10 @@ impl ArgMatches {
}
/// Deprecated, replaced with [`ArgMatches::get_many()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn values_of_lossy<T: Key>(&self, id: T) -> Option<Vec<String>> {
let id = Id::from(id);
@ -444,7 +459,10 @@ impl ArgMatches {
}
/// Deprecated, replaced with [`ArgMatches::get_many()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn values_of_os<T: Key>(&self, id: T) -> Option<OsValues> {
#![allow(deprecated)]
@ -458,7 +476,10 @@ impl ArgMatches {
}
/// Deprecated, replaced with [`ArgMatches::get_one()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_one()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_one()`")
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn value_of_t<R>(&self, name: &str) -> Result<R, Error>
where
@ -480,7 +501,10 @@ impl ArgMatches {
}
/// Deprecated, replaced with [`ArgMatches::get_one()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_one()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_one()`")
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn value_of_t_or_exit<R>(&self, name: &str) -> R
where
@ -492,7 +516,10 @@ impl ArgMatches {
}
/// Deprecated, replaced with [`ArgMatches::get_many()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn values_of_t<R>(&self, name: &str) -> Result<Vec<R>, Error>
where
@ -514,7 +541,10 @@ impl ArgMatches {
}
/// Deprecated, replaced with [`ArgMatches::get_many()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn values_of_t_or_exit<R>(&self, name: &str) -> Vec<R>
where
@ -527,9 +557,12 @@ impl ArgMatches {
/// Deprecated, replaced with [`ArgAction::SetTrue`][crate::ArgAction] or
/// [`ArgMatches::contains_id`].
#[deprecated(
since = "3.2.0",
note = "Replaced with either `ArgAction::SetTrue` or `ArgMatches::contains_id(...)`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "Replaced with either `ArgAction::SetTrue` or `ArgMatches::contains_id(...)`"
)
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn is_present<T: Key>(&self, id: T) -> bool {
@ -573,9 +606,12 @@ impl ArgMatches {
/// Deprecated, replaced with [`ArgAction::Count`][crate::ArgAction] or
/// [`ArgMatches::get_many`]`.len()`.
#[deprecated(
since = "3.2.0",
note = "Replaced with either `ArgAction::Count` or `ArgMatches::get_many(...).len()`"
#[cfg_attr(
feature = "deprecated",
deprecated(
since = "3.2.0",
note = "Replaced with either `ArgAction::Count` or `ArgMatches::get_many(...).len()`"
)
)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn occurrences_of<T: Key>(&self, id: T) -> u64 {
@ -813,7 +849,10 @@ impl ArgMatches {
#[inline]
#[doc(hidden)]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::try_get_one()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::try_get_one()`")
)]
pub fn is_valid_arg(&self, _id: impl Key) -> bool {
#[cfg(debug_assertions)]
{
@ -1461,7 +1500,10 @@ impl Default for RawValues<'_> {
// license: MIT - Copyright (c) 2015 The Rust Project Developers
/// Deprecated, replaced with [`ArgMatches::get_many()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")
)]
#[derive(Clone, Debug)]
pub struct Values<'a> {
#[allow(clippy::type_complexity)]
@ -1543,7 +1585,10 @@ impl<'a> Default for GroupedValues<'a> {
}
/// Deprecated, replaced with [`ArgMatches::get_many()`]
#[deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")]
#[cfg_attr(
feature = "deprecated",
deprecated(since = "3.2.0", note = "Replaced with `ArgMatches::get_many()`")
)]
#[derive(Clone, Debug)]
pub struct OsValues<'a> {
#[allow(clippy::type_complexity)]

View file

@ -67,17 +67,17 @@ impl MatchedArg {
}
}
#[deprecated(since = "3.2.0")]
#[cfg_attr(feature = "deprecated", deprecated(since = "3.2.0"))]
pub(crate) fn inc_occurrences(&mut self) {
self.occurs += 1;
}
#[deprecated(since = "3.2.0")]
#[cfg_attr(feature = "deprecated", deprecated(since = "3.2.0"))]
pub(crate) fn set_occurrences(&mut self, occurs: u64) {
self.occurs = occurs
}
#[deprecated(since = "3.2.0")]
#[cfg_attr(feature = "deprecated", deprecated(since = "3.2.0"))]
pub(crate) fn get_occurrences(&self) -> u64 {
self.occurs
}

View file

@ -1,17 +1,3 @@
warning: use of deprecated variant `clap::ArgAction::IncOccurrence`: Replaced with `ArgAction::SetTrue` or `ArgAction::Count`
--> tests/derive_ui/stable/bool_value_enum.rs:7:5
|
7 | opts: bool,
| ^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated variant `clap::ArgAction::IncOccurrence`: Replaced with `ArgAction::SetTrue` or `ArgAction::Count`
--> tests/derive_ui/stable/bool_value_enum.rs:7:5
|
7 | opts: bool,
| ^^^^
error[E0277]: the trait bound `bool: ValueEnum` is not satisfied
--> tests/derive_ui/stable/bool_value_enum.rs:7:11
|
@ -35,18 +21,6 @@ help: `bool` is a unit variant, you need to write it without the parenthesis
7 | opts: bool,
| ~~~~
warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgAction::SetTrue` or `ArgMatches::contains_id(...)`
--> tests/derive_ui/stable/bool_value_enum.rs:7:11
|
7 | opts: bool,
| ^^^^
warning: use of deprecated associated function `clap::Arg::<'help>::possible_values`: Replaced with `Arg::value_parser(PossibleValuesParser::new(...)).takes_value(true)`
--> tests/derive_ui/stable/bool_value_enum.rs:7:11
|
7 | opts: bool,
| ^^^^
error[E0277]: the trait bound `bool: ValueEnum` is not satisfied
--> tests/derive_ui/stable/bool_value_enum.rs:7:11
|

View file

@ -1,17 +1,3 @@
warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgAction::SetTrue` or `ArgMatches::contains_id(...)`
--> tests/derive_ui/stable/non_existent_attr.rs:15:12
|
15 | debug: bool,
| ^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated associated function `clap::ArgMatches::is_present`: Replaced with either `ArgAction::SetTrue` or `ArgMatches::contains_id(...)`
--> tests/derive_ui/stable/non_existent_attr.rs:15:12
|
15 | debug: bool,
| ^^^^
error[E0599]: no method named `non_existing_attribute` found for struct `Arg` in the current scope
--> tests/derive_ui/stable/non_existent_attr.rs:14:19
|