-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Please complete the following tasks
- I have searched the discussions
- I have searched the existing issues
Clap Version
3.0.10
Describe your use case
I had this idea while I was reviewing @sunshowers's CLI recommendations on versioning: https://rust-cli-recommendations.sunshowers.io/versioning.html. In their book they recommend having a stability flag or environment variable for gating new experimental features being exposed in your CLI. This made me think it would be nice if clap provided some support out of the box for managing the stability of various subsets of an App's CLI.
Describe the solution you'd like
I'm imagining two new methods being added to Arg
impl Arg {
/// Specifies that an argument is unstable.
///
/// **Note**: Unstable arguments cannot be used except when the `--unstable-options` flag is also enabled
fn unstable(self, yes: bool) -> Self;
/// Specifies that an argument is deprecated.
///
/// **Note**: Using a deprecated argument will produce a warning unless the `--allow-deprecated` flag is also enabled
fn deprecated(self, yes: bool) -> Self;
}
I'd expect these flags to also affect the generated help text to somehow deprioritize unstable/deprecated arguments in the generated output and to make it clear that they are not intended for general use.
Alternatives, if applicable
@epage and @sunshowers have both also suggested adding general support for custom settings / attributes so that a feature like this could be experimented with out of tree rather than needing to bake it into clap directly.
Additional Context
No response