mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
fix(derive): Remove deprecated arg_enum attribute
This commit is contained in:
parent
6523666a73
commit
b4b121d3a4
4 changed files with 3 additions and 3 deletions
|
@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- *(env)* Parse `--help` and `--version` like any `ArgAction::SetTrue` flag (#3776)
|
||||
- *(derive)* Changed the default for arguments from `parse` to `value_parser`., removing `parse` support
|
||||
- *(derive)* `subcommand_required(true).arg_required_else_help(true)` is set instead of `SubcommandRequiredElseHelp` (#3280)
|
||||
- *(derive)* Remove `arg_enum` attribute in favor of `value_enum`
|
||||
|
||||
### Compatibility
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ use std::path::PathBuf;
|
|||
)]
|
||||
struct Opt {
|
||||
/// If provided, outputs the completion file for given shell
|
||||
#[clap(long = "generate", arg_enum)]
|
||||
#[clap(long = "generate", value_enum)]
|
||||
generator: Option<Shell>,
|
||||
// Showcasing all possible ValueHints:
|
||||
#[clap(long, value_hint = ValueHint::Unknown)]
|
||||
|
|
|
@ -155,7 +155,6 @@ impl Parse for ClapAttr {
|
|||
"action" => Ok(Action(name)),
|
||||
"env" => Ok(Env(name)),
|
||||
"flatten" => Ok(Flatten(name)),
|
||||
"arg_enum" => Ok(ValueEnum(name)),
|
||||
"value_enum" => Ok(ValueEnum(name)),
|
||||
"from_global" => Ok(FromGlobal(name)),
|
||||
"subcommand" => Ok(Subcommand(name)),
|
||||
|
|
|
@ -4,7 +4,7 @@ use clap::{Parser, ValueEnum};
|
|||
#[clap(author, version, about, long_about = None)]
|
||||
struct Cli {
|
||||
/// What mode to run the program in
|
||||
#[clap(arg_enum)]
|
||||
#[clap(value_enum)]
|
||||
mode: Mode,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue