2814: fix(derive)!: Rename `Clap` to `Parser`. r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
This commit is contained in:
bors[bot] 2021-10-10 01:21:47 +00:00 committed by GitHub
commit d97c038b1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
96 changed files with 402 additions and 403 deletions

2
FAQ.md
View file

@ -20,7 +20,7 @@ Simple! `clap` *is* `structopt`. With the 3.0 release, `clap` imported the `stru
If you were using `structopt` before, you have to change the attributes from `#[structopt(...)]` to `#[clap(...)]`. If you were using `structopt` before, you have to change the attributes from `#[structopt(...)]` to `#[clap(...)]`.
Also the derive statements changed from `#[derive(Structopt)]` to `#[derive(Clap)]`. There is also some additional functionality and breaking changes that's been added to the `clap_derive` crate. See the documentation for that crate, for more details. Also the derive statements changed from `#[derive(Structopt)]` to `#[derive(Parser)]`. There is also some additional functionality and breaking changes that's been added to the `clap_derive` crate. See the documentation for that crate, for more details.
#### How does `clap` compare to [getopts](https://github.com/rust-lang-nursery/getopts)? #### How does `clap` compare to [getopts](https://github.com/rust-lang-nursery/getopts)?

View file

@ -138,11 +138,11 @@ The first example shows the simplest way to use `clap`, by defining a struct. If
// //
// This example demonstrates clap's full 'custom derive' style of creating arguments which is the // This example demonstrates clap's full 'custom derive' style of creating arguments which is the
// simplest method of use, but sacrifices some flexibility. // simplest method of use, but sacrifices some flexibility.
use clap::{AppSettings, Clap}; use clap::{AppSettings, Parser};
/// This doc string acts as a help message when the user runs '--help' /// This doc string acts as a help message when the user runs '--help'
/// as do all doc strings on fields /// as do all doc strings on fields
#[derive(Clap)] #[derive(Parser)]
#[clap(version = "1.0", author = "Kevin K. <kbknapp@gmail.com>")] #[clap(version = "1.0", author = "Kevin K. <kbknapp@gmail.com>")]
#[clap(setting = AppSettings::ColoredHelp)] #[clap(setting = AppSettings::ColoredHelp)]
struct Opts { struct Opts {
@ -158,14 +158,14 @@ struct Opts {
subcmd: SubCommand, subcmd: SubCommand,
} }
#[derive(Clap)] #[derive(Parser)]
enum SubCommand { enum SubCommand {
#[clap(version = "1.3", author = "Someone E. <someone_else@other.com>")] #[clap(version = "1.3", author = "Someone E. <someone_else@other.com>")]
Test(Test), Test(Test),
} }
/// A subcommand for controlling testing /// A subcommand for controlling testing
#[derive(Clap)] #[derive(Parser)]
struct Test { struct Test {
/// Print debug info /// Print debug info
#[clap(short)] #[clap(short)]
@ -471,7 +471,7 @@ Disabling optional features can decrease the binary size of `clap` and decrease
#### Features enabled by default #### Features enabled by default
* **std**: _Not Currently Used._ Placeholder for supporting `no_std` environments in a backwards compatible manner. * **std**: _Not Currently Used._ Placeholder for supporting `no_std` environments in a backwards compatible manner.
* **derive**: Enables the custom derive (i.e. `#[derive(Clap)]`). Without this you must use one of the other methods of creating a `clap` CLI listed above. (builds dependency `clap_derive`) * **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. (builds dependency `clap_derive`)
* **cargo**: Turns on macros that read values from `CARGO_*` environment variables. * **cargo**: Turns on macros that read values from `CARGO_*` environment variables.
* **color**: Turns on colored error messages. You still have to turn on colored help by setting `AppSettings::ColoredHelp`. (builds dependency `termcolor`) * **color**: Turns on colored error messages. You still have to turn on colored help by setting `AppSettings::ColoredHelp`. (builds dependency `termcolor`)
* **env**: Turns on the usage of environment variables during parsing. * **env**: Turns on the usage of environment variables during parsing.

View file

@ -19,10 +19,10 @@ clap = "3"
And then, in your rust file: And then, in your rust file:
```rust ```rust
use std::path::PathBuf; use std::path::PathBuf;
use clap::Clap; use clap::Parser;
/// A basic example /// A basic example
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
// A flag, true if used in the command line. Note doc comment will // A flag, true if used in the command line. Note doc comment will

View file

@ -1,11 +1,11 @@
//! How to append a postscript to the help message generated. //! How to append a postscript to the help message generated.
use clap::Clap; use clap::Parser;
/// I am a program and I do things. /// I am a program and I do things.
/// ///
/// Sometimes they even work. /// Sometimes they even work.
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(after_help = "Beware `-d`, dragons be here")] #[clap(after_help = "Beware `-d`, dragons be here")]
struct Opt { struct Opt {
/// Release the dragon. /// Release the dragon.

View file

@ -2,7 +2,7 @@
//! //!
//! All the variants of the enum and the enum itself support `rename_all` //! All the variants of the enum and the enum itself support `rename_all`
use clap::{ArgEnum, Clap}; use clap::{ArgEnum, Parser};
#[derive(ArgEnum, Debug, PartialEq, Clone)] #[derive(ArgEnum, Debug, PartialEq, Clone)]
enum ArgChoice { enum ArgChoice {
@ -19,7 +19,7 @@ enum ArgChoice {
Hidden, Hidden,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum)] #[clap(arg_enum)]
arg: ArgChoice, arg: ArgChoice,

View file

@ -1,9 +1,9 @@
//! How to require presence of at least N values, //! How to require presence of at least N values,
//! like `val1 val2 ... valN ... valM`. //! like `val1 val2 ... valN ... valM`.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt { struct Opt {
#[clap(required = true, min_values = 2)] #[clap(required = true, min_values = 2)]
foos: Vec<String>, foos: Vec<String>,

View file

@ -1,10 +1,10 @@
//! A somewhat comprehensive example of a typical `clap_derive` usage. //! A somewhat comprehensive example of a typical `clap_derive` usage.
use clap::{Clap, ValueHint}; use clap::{Parser, ValueHint};
use std::path::PathBuf; use std::path::PathBuf;
/// A basic example /// A basic example
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
// A flag, true if used in the command line. Note doc comment will // A flag, true if used in the command line. Note doc comment will

View file

@ -16,10 +16,10 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use clap::Clap; use clap::Parser;
/// The options /// The options
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
pub struct Opt { pub struct Opt {
#[clap(short)] #[clap(short)]
verbose: bool, verbose: bool,
@ -28,7 +28,7 @@ pub struct Opt {
} }
/// Some subcommands /// Some subcommands
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
pub enum Cmd { pub enum Cmd {
/// command A /// command A
A, A,
@ -43,7 +43,7 @@ pub enum Cmd {
} }
/// The options for C /// The options for C
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
pub struct COpt { pub struct COpt {
#[clap(short)] #[clap(short)]
bob: bool, bob: bool,

View file

@ -1,10 +1,10 @@
//! How to use doc comments in place of `help/long_help`. //! How to use doc comments in place of `help/long_help`.
use clap::Clap; use clap::Parser;
/// A basic example for the usage of doc comments as replacement /// A basic example for the usage of doc comments as replacement
/// of the arguments `help`, `long_help`, `about` and `long_about`. /// of the arguments `help`, `long_help`, `about` and `long_about`.
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
/// Just use doc comments to replace `help`, `long_help`, /// Just use doc comments to replace `help`, `long_help`,
@ -52,7 +52,7 @@ code) in the description:
sub_command: SubCommand, sub_command: SubCommand,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap()] #[clap()]
enum SubCommand { enum SubCommand {
/// The same rules described previously for flags. Are /// The same rules described previously for flags. Are

View file

@ -1,19 +1,19 @@
//! How to extract subcommands' args into external structs. //! How to extract subcommands' args into external structs.
use clap::Clap; use clap::Parser;
#[derive(Debug, Clap)] #[derive(Debug, Parser)]
pub struct Foo { pub struct Foo {
pub bar: Option<String>, pub bar: Option<String>,
} }
#[derive(Debug, Clap)] #[derive(Debug, Parser)]
pub enum Command { pub enum Command {
#[clap(name = "foo")] #[clap(name = "foo")]
Foo(Foo), Foo(Foo),
} }
#[derive(Debug, Clap)] #[derive(Debug, Parser)]
#[clap(name = "classify")] #[clap(name = "classify")]
pub struct ApplicationArguments { pub struct ApplicationArguments {
#[clap(subcommand)] #[clap(subcommand)]

View file

@ -1,10 +1,10 @@
//! How to use environment variable fallback an how it //! How to use environment variable fallback an how it
//! interacts with `default_value`. //! interacts with `default_value`.
use clap::{ArgSettings, Clap}; use clap::{ArgSettings, Parser};
/// Example for allowing to specify options via environment variables. /// Example for allowing to specify options via environment variables.
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "env")] #[clap(name = "env")]
struct Opt { struct Opt {
// Use `env` to enable specifying the option with an environment // Use `env` to enable specifying the option with an environment

View file

@ -1,8 +1,8 @@
//! Somewhat complex example of usage of #[derive(Clap)]. //! Somewhat complex example of usage of #[derive(Parser)].
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "example")] #[clap(name = "example")]
/// An example of clap_derive usage. /// An example of clap_derive usage.
struct Opt { struct Opt {

View file

@ -1,8 +1,8 @@
//! How to use flattening. //! How to use flattening.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Cmdline { struct Cmdline {
/// switch verbosity on /// switch verbosity on
#[clap(short)] #[clap(short)]
@ -12,7 +12,7 @@ struct Cmdline {
daemon_opts: DaemonOpts, daemon_opts: DaemonOpts,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct DaemonOpts { struct DaemonOpts {
/// daemon user /// daemon user
#[clap(short)] #[clap(short)]

View file

@ -1,8 +1,8 @@
//! How to derive the author, description, and version from Cargo.toml //! How to derive the author, description, and version from Cargo.toml
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(author, about, version)] #[clap(author, about, version)]
// ^^^^^^ <- derive author from Cargo.toml // ^^^^^^ <- derive author from Cargo.toml
// ^^^^^ <- derive description from Cargo.toml // ^^^^^ <- derive description from Cargo.toml

View file

@ -3,9 +3,9 @@
//! Documentation can be added either through doc comments or //! Documentation can be added either through doc comments or
//! `help`/`about` attributes. //! `help`/`about` attributes.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "git")] #[clap(name = "git")]
/// the stupid content tracker /// the stupid content tracker
enum Opt { enum Opt {

View file

@ -1,8 +1,8 @@
//! How to use `clap::Arg::group` //! How to use `clap::Arg::group`
use clap::{ArgGroup, Clap}; use clap::{ArgGroup, Parser};
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(group = ArgGroup::new("verb").required(true))] #[clap(group = ArgGroup::new("verb").required(true))]
struct Opt { struct Opt {
/// Set a custom HTTP verb /// Set a custom HTTP verb

View file

@ -1,6 +1,6 @@
//! How to parse "key=value" pairs with #[derive(Clap)]. //! How to parse "key=value" pairs with #[derive(Parser)].
use clap::Clap; use clap::Parser;
use std::error::Error; use std::error::Error;
/// Parse a single key-value pair /// Parse a single key-value pair
@ -17,7 +17,7 @@ where
Ok((s[..pos].parse()?, s[pos + 1..].parse()?)) Ok((s[..pos].parse()?, s[pos + 1..].parse()?))
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt { struct Opt {
// number_of_values = 1 forces the user to repeat the -D option for each key-value pair: // number_of_values = 1 forces the user to repeat the -D option for each key-value pair:
// my_program -D a=1 -D b=2 // my_program -D a=1 -D b=2

View file

@ -1,9 +1,9 @@
//! How to add `no-thing` flag which is `true` by default and //! How to add `no-thing` flag which is `true` by default and
//! `false` if passed. //! `false` if passed.
use clap::Clap; use clap::Parser;
#[derive(Debug, Clap)] #[derive(Debug, Parser)]
struct Opt { struct Opt {
#[clap(long = "no-verbose", parse(from_flag = std::ops::Not::not))] #[clap(long = "no-verbose", parse(from_flag = std::ops::Not::not))]
verbose: bool, verbose: bool,

View file

@ -18,9 +18,9 @@
//! with underscores. //! with underscores.
//! - **Verbatim**: Use the original attribute name defined in the code. //! - **Verbatim**: Use the original attribute name defined in the code.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "rename_all", rename_all = "screaming_snake_case")] #[clap(name = "rename_all", rename_all = "screaming_snake_case")]
enum Opt { enum Opt {
// This subcommand will be named `FIRST_COMMAND`. As the command doesn't // This subcommand will be named `FIRST_COMMAND`. As the command doesn't
@ -55,13 +55,13 @@ enum Opt {
}, },
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Subcommands { enum Subcommands {
// This one will be available as `first-subcommand`. // This one will be available as `first-subcommand`.
FirstSubcommand, FirstSubcommand,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct BonusOptions { struct BonusOptions {
// And this one will be available as `baz-option`. // And this one will be available as `baz-option`.
#[clap(long)] #[clap(long)]

View file

@ -1,8 +1,8 @@
//! How to use `#[clap(skip)]` //! How to use `#[clap(skip)]`
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
pub struct Opt { pub struct Opt {
#[clap(long, short)] #[clap(long, short)]
number: u32, number: u32,

View file

@ -1,8 +1,8 @@
//! How to assign some aliases to subcommands //! How to assign some aliases to subcommands
use clap::{AppSettings, Clap}; use clap::{AppSettings, Parser};
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
// https://docs.rs/clap/2/clap/enum.AppSettings.html#variant.InferSubcommands // https://docs.rs/clap/2/clap/enum.AppSettings.html#variant.InferSubcommands
#[clap(setting = AppSettings::InferSubcommands)] #[clap(setting = AppSettings::InferSubcommands)]
enum Opt { enum Opt {

View file

@ -1,6 +1,6 @@
//! How to parse `--foo=true --bar=false` and turn them into bool. //! How to parse `--foo=true --bar=false` and turn them into bool.
use clap::Clap; use clap::Parser;
fn true_or_false(s: &str) -> Result<bool, &'static str> { fn true_or_false(s: &str) -> Result<bool, &'static str> {
match s { match s {
@ -10,7 +10,7 @@ fn true_or_false(s: &str) -> Result<bool, &'static str> {
} }
} }
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
// Default parser for `try_from_str` is FromStr::from_str. // Default parser for `try_from_str` is FromStr::from_str.
// `impl FromStr for bool` parses `true` or `false` so this // `impl FromStr for bool` parses `true` or `false` so this

View file

@ -12,7 +12,7 @@
//! . ./value_hints_derive.fish //! . ./value_hints_derive.fish
//! ./target/debug/examples/value_hints_derive --<TAB> //! ./target/debug/examples/value_hints_derive --<TAB>
//! ``` //! ```
use clap::{App, AppSettings, ArgEnum, Clap, IntoApp, ValueHint}; use clap::{App, AppSettings, ArgEnum, IntoApp, Parser, ValueHint};
use clap_generate::generators::{Bash, Elvish, Fish, PowerShell, Zsh}; use clap_generate::generators::{Bash, Elvish, Fish, PowerShell, Zsh};
use clap_generate::{generate, Generator}; use clap_generate::{generate, Generator};
use std::ffi::OsString; use std::ffi::OsString;
@ -29,7 +29,7 @@ enum GeneratorChoice {
Zsh, Zsh,
} }
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
#[clap( #[clap(
name = "value_hints_derive", name = "value_hints_derive",
// AppSettings::TrailingVarArg is required to use ValueHint::CommandWithArguments // AppSettings::TrailingVarArg is required to use ValueHint::CommandWithArguments

View file

@ -13,11 +13,11 @@
// MIT/Apache 2.0 license. // MIT/Apache 2.0 license.
mod arg_enum; mod arg_enum;
mod args; mod args;
mod clap;
mod into_app; mod into_app;
mod parser;
mod subcommand; mod subcommand;
pub use self::clap::derive_clap; pub use self::parser::derive_parser;
pub use arg_enum::derive_arg_enum; pub use arg_enum::derive_arg_enum;
pub use args::derive_args; pub use args::derive_args;
pub use into_app::derive_into_app; pub use into_app::derive_into_app;

View file

@ -25,7 +25,7 @@ use syn::{
Field, Fields, Ident, Field, Fields, Ident,
}; };
pub fn derive_clap(input: &DeriveInput) -> TokenStream { pub fn derive_parser(input: &DeriveInput) -> TokenStream {
let ident = &input.ident; let ident = &input.ident;
match input.data { match input.data {
@ -33,21 +33,21 @@ pub fn derive_clap(input: &DeriveInput) -> TokenStream {
fields: Fields::Named(ref fields), fields: Fields::Named(ref fields),
.. ..
}) => { }) => {
dummies::clap_struct(ident); dummies::parser_struct(ident);
gen_for_struct(ident, &fields.named, &input.attrs) gen_for_struct(ident, &fields.named, &input.attrs)
} }
Data::Struct(DataStruct { Data::Struct(DataStruct {
fields: Fields::Unit, fields: Fields::Unit,
.. ..
}) => { }) => {
dummies::clap_struct(ident); dummies::parser_struct(ident);
gen_for_struct(ident, &Punctuated::<Field, Comma>::new(), &input.attrs) gen_for_struct(ident, &Punctuated::<Field, Comma>::new(), &input.attrs)
} }
Data::Enum(ref e) => { Data::Enum(ref e) => {
dummies::clap_enum(ident); dummies::parser_enum(ident);
gen_for_enum(ident, &input.attrs, e) gen_for_enum(ident, &input.attrs, e)
} }
_ => abort_call_site!("`#[derive(Clap)]` only supports non-tuple structs and enums"), _ => abort_call_site!("`#[derive(Parser)]` only supports non-tuple structs and enums"),
} }
} }
@ -60,7 +60,7 @@ fn gen_for_struct(
let args = args::gen_for_struct(name, fields, attrs); let args = args::gen_for_struct(name, fields, attrs);
quote! { quote! {
impl clap::Clap for #name {} impl clap::Parser for #name {}
#into_app #into_app
#args #args
@ -72,7 +72,7 @@ fn gen_for_enum(name: &Ident, attrs: &[Attribute], e: &DataEnum) -> TokenStream
let subcommand = subcommand::gen_for_enum(name, attrs, e); let subcommand = subcommand::gen_for_enum(name, attrs, e);
quote! { quote! {
impl clap::Clap for #name {} impl clap::Parser for #name {}
#into_app #into_app
#subcommand #subcommand

View file

@ -4,16 +4,16 @@ use proc_macro2::Ident;
use proc_macro_error::append_dummy; use proc_macro_error::append_dummy;
use quote::quote; use quote::quote;
pub fn clap_struct(name: &Ident) { pub fn parser_struct(name: &Ident) {
into_app(name); into_app(name);
args(name); args(name);
append_dummy(quote!( impl clap::Clap for #name {} )); append_dummy(quote!( impl clap::Parser for #name {} ));
} }
pub fn clap_enum(name: &Ident) { pub fn parser_enum(name: &Ident) {
into_app(name); into_app(name);
subcommand(name); subcommand(name);
append_dummy(quote!( impl clap::Clap for #name {} )); append_dummy(quote!( impl clap::Parser for #name {} ));
} }
pub fn into_app(name: &Ident) { pub fn into_app(name: &Ident) {

View file

@ -17,7 +17,7 @@
//! This crate is custom derive for clap. It should not be used //! This crate is custom derive for clap. It should not be used
//! directly. See [clap documentation](clap) //! directly. See [clap documentation](clap)
//! for the usage of `#[derive(Clap)]`. //! for the usage of `#[derive(Parser)]`.
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
@ -41,17 +41,17 @@ pub fn arg_enum(input: TokenStream) -> TokenStream {
derives::derive_arg_enum(&input).into() derives::derive_arg_enum(&input).into()
} }
/// Generates the `Clap` implementation. /// Generates the `Parser` implementation.
/// ///
/// This is far less verbose than defining the `clap::App` struct manually, /// This is far less verbose than defining the `clap::App` struct manually,
/// receiving an instance of `clap::ArgMatches` from conducting parsing, and then /// receiving an instance of `clap::ArgMatches` from conducting parsing, and then
/// implementing a conversion code to instantiate an instance of the user /// implementing a conversion code to instantiate an instance of the user
/// context struct. /// context struct.
#[proc_macro_derive(Clap, attributes(clap))] #[proc_macro_derive(Parser, attributes(clap))]
#[proc_macro_error] #[proc_macro_error]
pub fn clap(input: TokenStream) -> TokenStream { pub fn parser(input: TokenStream) -> TokenStream {
let input: DeriveInput = parse_macro_input!(input); let input: DeriveInput = parse_macro_input!(input);
derives::derive_clap(&input).into() derives::derive_parser(&input).into()
} }
/// Generates the `IntoApp` impl. /// Generates the `IntoApp` impl.

View file

@ -1,6 +1,6 @@
//! The preprocessing we apply to doc comments. //! The preprocessing we apply to doc comments.
//! //!
//! #[derive(Clap)] works in terms of "paragraphs". Paragraph is a sequence of //! #[derive(Parser)] works in terms of "paragraphs". Paragraph is a sequence of
//! non-empty adjacent lines, delimited by sequences of blank (whitespace only) lines. //! non-empty adjacent lines, delimited by sequences of blank (whitespace only) lines.
use crate::attrs::Method; use crate::attrs::Method;

View file

@ -1,8 +1,8 @@
use clap::Clap;
use clap::IntoApp; use clap::IntoApp;
use clap::Parser;
#[test] #[test]
fn app_name_in_short_help_from_struct() { fn app_name_in_short_help_from_struct() {
#[derive(Clap)] #[derive(Parser)]
#[clap(name = "my-app")] #[clap(name = "my-app")]
struct MyApp {} struct MyApp {}
@ -15,7 +15,7 @@ fn app_name_in_short_help_from_struct() {
#[test] #[test]
fn app_name_in_long_help_from_struct() { fn app_name_in_long_help_from_struct() {
#[derive(Clap)] #[derive(Parser)]
#[clap(name = "my-app")] #[clap(name = "my-app")]
struct MyApp {} struct MyApp {}
@ -28,7 +28,7 @@ fn app_name_in_long_help_from_struct() {
#[test] #[test]
fn app_name_in_short_help_from_enum() { fn app_name_in_short_help_from_enum() {
#[derive(Clap)] #[derive(Parser)]
#[clap(name = "my-app")] #[clap(name = "my-app")]
enum MyApp {} enum MyApp {}
@ -41,7 +41,7 @@ fn app_name_in_short_help_from_enum() {
#[test] #[test]
fn app_name_in_long_help_from_enum() { fn app_name_in_long_help_from_enum() {
#[derive(Clap)] #[derive(Parser)]
#[clap(name = "my-app")] #[clap(name = "my-app")]
enum MyApp {} enum MyApp {}
@ -54,7 +54,7 @@ fn app_name_in_long_help_from_enum() {
#[test] #[test]
fn app_name_in_short_version_from_struct() { fn app_name_in_short_version_from_struct() {
#[derive(Clap)] #[derive(Parser)]
#[clap(name = "my-app")] #[clap(name = "my-app")]
struct MyApp {} struct MyApp {}
@ -65,7 +65,7 @@ fn app_name_in_short_version_from_struct() {
#[test] #[test]
fn app_name_in_long_version_from_struct() { fn app_name_in_long_version_from_struct() {
#[derive(Clap)] #[derive(Parser)]
#[clap(name = "my-app")] #[clap(name = "my-app")]
struct MyApp {} struct MyApp {}
@ -76,7 +76,7 @@ fn app_name_in_long_version_from_struct() {
#[test] #[test]
fn app_name_in_short_version_from_enum() { fn app_name_in_short_version_from_enum() {
#[derive(Clap)] #[derive(Parser)]
#[clap(name = "my-app")] #[clap(name = "my-app")]
enum MyApp {} enum MyApp {}
@ -87,7 +87,7 @@ fn app_name_in_short_version_from_enum() {
#[test] #[test]
fn app_name_in_long_version_from_enum() { fn app_name_in_long_version_from_enum() {
#[derive(Clap)] #[derive(Parser)]
#[clap(name = "my-app")] #[clap(name = "my-app")]
enum MyApp {} enum MyApp {}

View file

@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::{ArgEnum, ArgValue, Clap}; use clap::{ArgEnum, ArgValue, Parser};
#[test] #[test]
fn basic() { fn basic() {
@ -17,7 +17,7 @@ fn basic() {
Bar, Bar,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum)] #[clap(arg_enum)]
arg: ArgChoice, arg: ArgChoice,
@ -58,7 +58,7 @@ fn default_value() {
} }
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum, default_value_t)] #[clap(arg_enum, default_value_t)]
arg: ArgChoice, arg: ArgChoice,
@ -93,7 +93,7 @@ fn multi_word_is_renamed_kebab() {
BAR_BAZ, BAR_BAZ,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum)] #[clap(arg_enum)]
arg: ArgChoice, arg: ArgChoice,
@ -122,7 +122,7 @@ fn variant_with_defined_casing() {
FooBar, FooBar,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum)] #[clap(arg_enum)]
arg: ArgChoice, arg: ArgChoice,
@ -145,7 +145,7 @@ fn casing_is_propogated_from_parent() {
FooBar, FooBar,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum)] #[clap(arg_enum)]
arg: ArgChoice, arg: ArgChoice,
@ -169,7 +169,7 @@ fn casing_propogation_is_overridden() {
FooBar, FooBar,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum)] #[clap(arg_enum)]
arg: ArgChoice, arg: ArgChoice,
@ -192,7 +192,7 @@ fn case_insensitive() {
Foo, Foo,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum, case_insensitive(true))] #[clap(arg_enum, case_insensitive(true))]
arg: ArgChoice, arg: ArgChoice,
@ -219,7 +219,7 @@ fn case_insensitive_set_to_false() {
Foo, Foo,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum, case_insensitive(false))] #[clap(arg_enum, case_insensitive(false))]
arg: ArgChoice, arg: ArgChoice,
@ -242,7 +242,7 @@ fn alias() {
TOTP, TOTP,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum, case_insensitive(false))] #[clap(arg_enum, case_insensitive(false))]
arg: ArgChoice, arg: ArgChoice,
@ -270,7 +270,7 @@ fn multiple_alias() {
TOTP, TOTP,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum, case_insensitive(false))] #[clap(arg_enum, case_insensitive(false))]
arg: ArgChoice, arg: ArgChoice,
@ -304,7 +304,7 @@ fn option() {
Bar, Bar,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum)] #[clap(arg_enum)]
arg: Option<ArgChoice>, arg: Option<ArgChoice>,
@ -334,7 +334,7 @@ fn vector() {
Bar, Bar,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(arg_enum, short, long)] #[clap(arg_enum, short, long)]
arg: Vec<ArgChoice>, arg: Vec<ArgChoice>,

View file

@ -1,8 +1,8 @@
use clap::Clap; use clap::Parser;
#[test] #[test]
fn test_single_word_enum_variant_is_default_renamed_into_kebab_case() { fn test_single_word_enum_variant_is_default_renamed_into_kebab_case() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
enum Opt { enum Opt {
Command { foo: u32 }, Command { foo: u32 },
} }
@ -15,7 +15,7 @@ fn test_single_word_enum_variant_is_default_renamed_into_kebab_case() {
#[test] #[test]
fn test_multi_word_enum_variant_is_renamed() { fn test_multi_word_enum_variant_is_renamed() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
enum Opt { enum Opt {
FirstCommand { foo: u32 }, FirstCommand { foo: u32 },
} }
@ -28,7 +28,7 @@ fn test_multi_word_enum_variant_is_renamed() {
#[test] #[test]
fn test_standalone_long_generates_kebab_case() { fn test_standalone_long_generates_kebab_case() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
#[allow(non_snake_case)] #[allow(non_snake_case)]
struct Opt { struct Opt {
#[clap(long)] #[clap(long)]
@ -43,7 +43,7 @@ fn test_standalone_long_generates_kebab_case() {
#[test] #[test]
fn test_custom_long_overwrites_default_name() { fn test_custom_long_overwrites_default_name() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(long = "foo")] #[clap(long = "foo")]
foo_option: bool, foo_option: bool,
@ -57,7 +57,7 @@ fn test_custom_long_overwrites_default_name() {
#[test] #[test]
fn test_standalone_long_uses_previous_defined_custom_name() { fn test_standalone_long_uses_previous_defined_custom_name() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(name = "foo", long)] #[clap(name = "foo", long)]
foo_option: bool, foo_option: bool,
@ -71,7 +71,7 @@ fn test_standalone_long_uses_previous_defined_custom_name() {
#[test] #[test]
fn test_standalone_long_ignores_afterwards_defined_custom_name() { fn test_standalone_long_ignores_afterwards_defined_custom_name() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(long, name = "foo")] #[clap(long, name = "foo")]
foo_option: bool, foo_option: bool,
@ -85,7 +85,7 @@ fn test_standalone_long_ignores_afterwards_defined_custom_name() {
#[test] #[test]
fn test_standalone_short_generates_kebab_case() { fn test_standalone_short_generates_kebab_case() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
#[allow(non_snake_case)] #[allow(non_snake_case)]
struct Opt { struct Opt {
#[clap(short)] #[clap(short)]
@ -97,7 +97,7 @@ fn test_standalone_short_generates_kebab_case() {
#[test] #[test]
fn test_custom_short_overwrites_default_name() { fn test_custom_short_overwrites_default_name() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(short = 'o')] #[clap(short = 'o')]
foo_option: bool, foo_option: bool,
@ -108,7 +108,7 @@ fn test_custom_short_overwrites_default_name() {
#[test] #[test]
fn test_standalone_short_uses_previous_defined_custom_name() { fn test_standalone_short_uses_previous_defined_custom_name() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(name = "option", short)] #[clap(name = "option", short)]
foo_option: bool, foo_option: bool,
@ -119,7 +119,7 @@ fn test_standalone_short_uses_previous_defined_custom_name() {
#[test] #[test]
fn test_standalone_short_ignores_afterwards_defined_custom_name() { fn test_standalone_short_ignores_afterwards_defined_custom_name() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(short, name = "option")] #[clap(short, name = "option")]
foo_option: bool, foo_option: bool,
@ -130,7 +130,7 @@ fn test_standalone_short_ignores_afterwards_defined_custom_name() {
#[test] #[test]
fn test_standalone_long_uses_previous_defined_casing() { fn test_standalone_long_uses_previous_defined_casing() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(rename_all = "screaming_snake", long)] #[clap(rename_all = "screaming_snake", long)]
foo_option: bool, foo_option: bool,
@ -144,7 +144,7 @@ fn test_standalone_long_uses_previous_defined_casing() {
#[test] #[test]
fn test_standalone_short_uses_previous_defined_casing() { fn test_standalone_short_uses_previous_defined_casing() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(rename_all = "screaming_snake", short)] #[clap(rename_all = "screaming_snake", short)]
foo_option: bool, foo_option: bool,
@ -155,7 +155,7 @@ fn test_standalone_short_uses_previous_defined_casing() {
#[test] #[test]
fn test_standalone_long_works_with_verbatim_casing() { fn test_standalone_long_works_with_verbatim_casing() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
#[allow(non_snake_case)] #[allow(non_snake_case)]
struct Opt { struct Opt {
#[clap(rename_all = "verbatim", long)] #[clap(rename_all = "verbatim", long)]
@ -170,7 +170,7 @@ fn test_standalone_long_works_with_verbatim_casing() {
#[test] #[test]
fn test_standalone_short_works_with_verbatim_casing() { fn test_standalone_short_works_with_verbatim_casing() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(rename_all = "verbatim", short)] #[clap(rename_all = "verbatim", short)]
_foo: bool, _foo: bool,
@ -181,7 +181,7 @@ fn test_standalone_short_works_with_verbatim_casing() {
#[test] #[test]
fn test_rename_all_is_propagated_from_struct_to_fields() { fn test_rename_all_is_propagated_from_struct_to_fields() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
#[clap(rename_all = "screaming_snake")] #[clap(rename_all = "screaming_snake")]
struct Opt { struct Opt {
#[clap(long)] #[clap(long)]
@ -193,14 +193,14 @@ fn test_rename_all_is_propagated_from_struct_to_fields() {
#[test] #[test]
fn test_rename_all_is_not_propagated_from_struct_into_flattened() { fn test_rename_all_is_not_propagated_from_struct_into_flattened() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
#[clap(rename_all = "screaming_snake")] #[clap(rename_all = "screaming_snake")]
struct Opt { struct Opt {
#[clap(flatten)] #[clap(flatten)]
foo: Foo, foo: Foo,
} }
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Foo { struct Foo {
#[clap(long)] #[clap(long)]
foo: bool, foo: bool,
@ -216,14 +216,14 @@ fn test_rename_all_is_not_propagated_from_struct_into_flattened() {
#[test] #[test]
fn test_rename_all_is_not_propagated_from_struct_into_subcommand() { fn test_rename_all_is_not_propagated_from_struct_into_subcommand() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
#[clap(rename_all = "screaming_snake")] #[clap(rename_all = "screaming_snake")]
struct Opt { struct Opt {
#[clap(subcommand)] #[clap(subcommand)]
foo: Foo, foo: Foo,
} }
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
enum Foo { enum Foo {
Command { Command {
#[clap(long)] #[clap(long)]
@ -241,7 +241,7 @@ fn test_rename_all_is_not_propagated_from_struct_into_subcommand() {
#[test] #[test]
fn test_rename_all_is_propagated_from_enum_to_variants_and_their_fields() { fn test_rename_all_is_propagated_from_enum_to_variants_and_their_fields() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
#[clap(rename_all = "screaming_snake")] #[clap(rename_all = "screaming_snake")]
enum Opt { enum Opt {
FirstVariant, FirstVariant,
@ -264,7 +264,7 @@ fn test_rename_all_is_propagated_from_enum_to_variants_and_their_fields() {
#[test] #[test]
fn test_rename_all_is_propagation_can_be_overridden() { fn test_rename_all_is_propagation_can_be_overridden() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
#[clap(rename_all = "screaming_snake")] #[clap(rename_all = "screaming_snake")]
enum Opt { enum Opt {
#[clap(rename_all = "kebab_case")] #[clap(rename_all = "kebab_case")]
@ -291,7 +291,7 @@ fn test_rename_all_is_propagation_can_be_overridden() {
#[test] #[test]
fn test_lower_is_renamed() { fn test_lower_is_renamed() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(rename_all = "lower", long)] #[clap(rename_all = "lower", long)]
foo_option: bool, foo_option: bool,
@ -305,7 +305,7 @@ fn test_lower_is_renamed() {
#[test] #[test]
fn test_upper_is_renamed() { fn test_upper_is_renamed() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(rename_all = "upper", long)] #[clap(rename_all = "upper", long)]
foo_option: bool, foo_option: bool,

View file

@ -12,12 +12,12 @@
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the // commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
// MIT/Apache 2.0 license. // MIT/Apache 2.0 license.
use clap::Clap;
use clap::IntoApp; use clap::IntoApp;
use clap::Parser;
#[test] #[test]
fn required_argument() { fn required_argument() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
arg: i32, arg: i32,
} }
@ -28,7 +28,7 @@ fn required_argument() {
#[test] #[test]
fn optional_argument() { fn optional_argument() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
arg: Option<i32>, arg: Option<i32>,
} }
@ -39,7 +39,7 @@ fn optional_argument() {
#[test] #[test]
fn argument_with_default() { fn argument_with_default() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(default_value = "42")] #[clap(default_value = "42")]
arg: i32, arg: i32,
@ -51,7 +51,7 @@ fn argument_with_default() {
#[test] #[test]
fn arguments() { fn arguments() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
arg: Vec<i32>, arg: Vec<i32>,
} }
@ -65,7 +65,7 @@ fn arguments() {
#[test] #[test]
fn arguments_safe() { fn arguments_safe() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
arg: Vec<i32>, arg: Vec<i32>,
} }
@ -87,7 +87,7 @@ fn arguments_safe() {
#[test] #[test]
fn auto_value_name() { fn auto_value_name() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
my_special_arg: i32, my_special_arg: i32,
} }
@ -103,7 +103,7 @@ fn auto_value_name() {
#[test] #[test]
fn explicit_value_name() { fn explicit_value_name() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(value_name = "BROWNIE_POINTS")] #[clap(value_name = "BROWNIE_POINTS")]
my_special_arg: i32, my_special_arg: i32,

View file

@ -14,12 +14,12 @@
mod utils; mod utils;
use clap::Clap; use clap::Parser;
use utils::*; use utils::*;
#[test] #[test]
fn no_author_version_about() { fn no_author_version_about() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
#[clap(name = "foo")] #[clap(name = "foo")]
struct Opt {} struct Opt {}
@ -29,7 +29,7 @@ fn no_author_version_about() {
#[test] #[test]
fn use_env() { fn use_env() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
#[clap(author, about, version)] #[clap(author, about, version)]
struct Opt {} struct Opt {}
@ -43,7 +43,7 @@ fn use_env() {
fn explicit_version_not_str_lit() { fn explicit_version_not_str_lit() {
const VERSION: &str = "custom version"; const VERSION: &str = "custom version";
#[derive(Clap)] #[derive(Parser)]
#[clap(version = VERSION)] #[clap(version = VERSION)]
pub struct Opt {} pub struct Opt {}

View file

@ -12,11 +12,11 @@
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the // commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
// MIT/Apache 2.0 license. // MIT/Apache 2.0 license.
use clap::Clap; use clap::Parser;
#[test] #[test]
fn basic() { fn basic() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short = 'a', long = "arg")] #[clap(short = 'a', long = "arg")]
arg: Vec<i32>, arg: Vec<i32>,
@ -31,7 +31,7 @@ fn basic() {
#[test] #[test]
fn update_basic() { fn update_basic() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short = 'a', long = "arg")] #[clap(short = 'a', long = "arg")]
single_value: i32, single_value: i32,
@ -46,7 +46,7 @@ fn update_basic() {
#[test] #[test]
fn unit_struct() { fn unit_struct() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt; struct Opt;
assert_eq!(Opt {}, Opt::parse_from(&["test"])); assert_eq!(Opt {}, Opt::parse_from(&["test"]));

View file

@ -1,12 +1,12 @@
use clap::Clap; use clap::Parser;
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(subcommand)] #[clap(subcommand)]
sub: Box<Sub>, sub: Box<Sub>,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Sub { enum Sub {
Flame { Flame {
#[clap(flatten)] #[clap(flatten)]
@ -14,7 +14,7 @@ enum Sub {
}, },
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Ext { struct Ext {
arg: u32, arg: u32,
} }

View file

@ -12,13 +12,13 @@
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the // commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
// MIT/Apache 2.0 license. // MIT/Apache 2.0 license.
use clap::Clap; use clap::Parser;
use std::ffi::{CString, OsStr}; use std::ffi::{CString, OsStr};
use std::num::ParseIntError; use std::num::ParseIntError;
use std::path::PathBuf; use std::path::PathBuf;
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct PathOpt { struct PathOpt {
#[clap(short, long, parse(from_os_str))] #[clap(short, long, parse(from_os_str))]
path: PathBuf, path: PathBuf,
@ -61,7 +61,7 @@ fn parse_hex(input: &str) -> Result<u64, ParseIntError> {
u64::from_str_radix(input, 16) u64::from_str_radix(input, 16)
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct HexOpt { struct HexOpt {
#[clap(short, parse(try_from_str = parse_hex))] #[clap(short, parse(try_from_str = parse_hex))]
number: u64, number: u64,
@ -109,7 +109,7 @@ fn custom_parser_4(_: &OsStr) -> Result<&'static str, String> {
Ok("D") Ok("D")
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct NoOpOpt { struct NoOpOpt {
#[clap(short, parse(from_str = custom_parser_1))] #[clap(short, parse(from_str = custom_parser_1))]
a: &'static str, a: &'static str,
@ -160,7 +160,7 @@ fn update_every_custom_parser() {
// conversion function from `&str` to `u8`. // conversion function from `&str` to `u8`.
type Bytes = Vec<u8>; type Bytes = Vec<u8>;
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct DefaultedOpt { struct DefaultedOpt {
#[clap(short, parse(from_str))] #[clap(short, parse(from_str))]
bytes: Bytes, bytes: Bytes,
@ -199,7 +199,7 @@ fn foo(value: u64) -> Foo {
Foo(value as u8) Foo(value as u8)
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Occurrences { struct Occurrences {
#[clap(short, long, parse(from_occurrences))] #[clap(short, long, parse(from_occurrences))]
signed: i32, signed: i32,
@ -242,7 +242,7 @@ fn test_custom_bool() {
_ => Err(format!("invalid bool {}", s)), _ => Err(format!("invalid bool {}", s)),
} }
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, parse(try_from_str = parse_bool))] #[clap(short, parse(try_from_str = parse_bool))]
debug: bool, debug: bool,
@ -328,7 +328,7 @@ fn test_custom_bool() {
#[test] #[test]
fn test_cstring() { fn test_cstring() {
#[derive(Clap)] #[derive(Parser)]
struct Opt { struct Opt {
#[clap(parse(try_from_str = CString::new))] #[clap(parse(try_from_str = CString::new))]
c_string: CString, c_string: CString,

View file

@ -1,4 +1,4 @@
use clap::Clap; use clap::Parser;
mod utils; mod utils;
@ -6,7 +6,7 @@ use utils::*;
#[test] #[test]
fn default_value() { fn default_value() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(default_value = "3")] #[clap(default_value = "3")]
arg: i32, arg: i32,
@ -20,7 +20,7 @@ fn default_value() {
#[test] #[test]
fn default_value_t() { fn default_value_t() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(default_value_t = 3)] #[clap(default_value_t = 3)]
arg: i32, arg: i32,
@ -34,7 +34,7 @@ fn default_value_t() {
#[test] #[test]
fn auto_default_value_t() { fn auto_default_value_t() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(default_value_t)] #[clap(default_value_t)]
arg: i32, arg: i32,

View file

@ -14,7 +14,7 @@
#![deny(warnings)] #![deny(warnings)]
use clap::Clap; use clap::Parser;
fn try_str(s: &str) -> Result<String, std::convert::Infallible> { fn try_str(s: &str) -> Result<String, std::convert::Infallible> {
Ok(s.into()) Ok(s.into())
@ -22,7 +22,7 @@ fn try_str(s: &str) -> Result<String, std::convert::Infallible> {
#[test] #[test]
fn warning_never_struct() { fn warning_never_struct() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(parse(try_from_str = try_str))] #[clap(parse(try_from_str = try_str))]
s: String, s: String,
@ -37,7 +37,7 @@ fn warning_never_struct() {
#[test] #[test]
fn warning_never_enum() { fn warning_never_enum() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
enum Opt { enum Opt {
Foo { Foo {
#[clap(parse(try_from_str = try_str))] #[clap(parse(try_from_str = try_str))]

View file

@ -14,13 +14,13 @@
mod utils; mod utils;
use clap::Clap; use clap::Parser;
use utils::*; use utils::*;
#[test] #[test]
fn doc_comments() { fn doc_comments() {
/// Lorem ipsum /// Lorem ipsum
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct LoremIpsum { struct LoremIpsum {
/// Fooify a bar /// Fooify a bar
/// and a baz /// and a baz
@ -36,7 +36,7 @@ fn doc_comments() {
#[test] #[test]
fn help_is_better_than_comments() { fn help_is_better_than_comments() {
/// Lorem ipsum /// Lorem ipsum
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
#[clap(name = "lorem-ipsum", about = "Dolor sit amet")] #[clap(name = "lorem-ipsum", about = "Dolor sit amet")]
struct LoremIpsum { struct LoremIpsum {
/// Fooify a bar /// Fooify a bar
@ -55,7 +55,7 @@ fn empty_line_in_doc_comment_is_double_linefeed() {
/// Foo. /// Foo.
/// ///
/// Bar /// Bar
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
#[clap(name = "lorem-ipsum")] #[clap(name = "lorem-ipsum")]
struct LoremIpsum {} struct LoremIpsum {}
@ -66,7 +66,7 @@ fn empty_line_in_doc_comment_is_double_linefeed() {
#[test] #[test]
fn field_long_doc_comment_both_help_long_help() { fn field_long_doc_comment_both_help_long_help() {
/// Lorem ipsumclap /// Lorem ipsumclap
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
#[clap(name = "lorem-ipsum", about = "Dolor sit amet")] #[clap(name = "lorem-ipsum", about = "Dolor sit amet")]
struct LoremIpsum { struct LoremIpsum {
/// Dot is removed from multiline comments. /// Dot is removed from multiline comments.
@ -94,14 +94,14 @@ fn field_long_doc_comment_both_help_long_help() {
#[test] #[test]
fn top_long_doc_comment_both_help_long_help() { fn top_long_doc_comment_both_help_long_help() {
/// Lorem ipsumclap /// Lorem ipsumclap
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "lorem-ipsum", about = "Dolor sit amet")] #[clap(name = "lorem-ipsum", about = "Dolor sit amet")]
struct LoremIpsum { struct LoremIpsum {
#[clap(subcommand)] #[clap(subcommand)]
foo: SubCommand, foo: SubCommand,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
pub enum SubCommand { pub enum SubCommand {
/// DO NOT PASS A BAR UNDER ANY CIRCUMSTANCES /// DO NOT PASS A BAR UNDER ANY CIRCUMSTANCES
/// ///
@ -139,7 +139,7 @@ fn verbatim_doc_comment() {
/// \\ || /// \\ ||
/// ( () || /// ( () ||
/// ( () ) ) /// ( () ) )
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(verbatim_doc_comment)] #[clap(verbatim_doc_comment)]
struct SeeFigure1 { struct SeeFigure1 {
#[clap(long)] #[clap(long)]
@ -169,7 +169,7 @@ fn verbatim_doc_comment() {
#[test] #[test]
fn verbatim_doc_comment_field() { fn verbatim_doc_comment_field() {
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct App { struct App {
/// This help ends in a period. /// This help ends in a period.
#[clap(long, verbatim_doc_comment)] #[clap(long, verbatim_doc_comment)]

View file

@ -1,11 +1,11 @@
mod utils; mod utils;
use clap::Clap; use clap::Parser;
use utils::*; use utils::*;
#[test] #[test]
fn explicit_short_long_no_rename() { fn explicit_short_long_no_rename() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short = '.', long = ".foo", multiple_occurrences(true))] #[clap(short = '.', long = ".foo", multiple_occurrences(true))]
foo: Vec<String>, foo: Vec<String>,
@ -21,7 +21,7 @@ fn explicit_short_long_no_rename() {
#[test] #[test]
fn explicit_name_no_rename() { fn explicit_name_no_rename() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(name = ".options")] #[clap(name = ".options")]
foo: Vec<String>, foo: Vec<String>,

View file

@ -12,11 +12,11 @@
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the // commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
// MIT/Apache 2.0 license. // MIT/Apache 2.0 license.
use clap::Clap; use clap::Parser;
#[test] #[test]
fn unique_flag() { fn unique_flag() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, long)] #[clap(short, long)]
alice: bool, alice: bool,
@ -33,7 +33,7 @@ fn unique_flag() {
#[test] #[test]
fn multiple_flag() { fn multiple_flag() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, long, parse(from_occurrences))] #[clap(short, long, parse(from_occurrences))]
alice: u64, alice: u64,
@ -65,7 +65,7 @@ fn parse_from_flag(b: bool) -> std::sync::atomic::AtomicBool {
#[test] #[test]
fn non_bool_flags() { fn non_bool_flags() {
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt { struct Opt {
#[clap(short, long, parse(from_flag = parse_from_flag))] #[clap(short, long, parse(from_flag = parse_from_flag))]
alice: std::sync::atomic::AtomicBool, alice: std::sync::atomic::AtomicBool,
@ -92,7 +92,7 @@ fn non_bool_flags() {
#[test] #[test]
fn combined_flags() { fn combined_flags() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, long)] #[clap(short, long)]
alice: bool, alice: bool,

View file

@ -14,17 +14,17 @@
mod utils; mod utils;
use clap::Clap; use clap::Parser;
use utils::get_help; use utils::get_help;
#[test] #[test]
fn flatten() { fn flatten() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Common { struct Common {
arg: i32, arg: i32,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(flatten)] #[clap(flatten)]
common: Common, common: Common,
@ -43,12 +43,12 @@ fn flatten() {
#[test] #[test]
#[should_panic] #[should_panic]
fn flatten_twice() { fn flatten_twice() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Common { struct Common {
arg: i32, arg: i32,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(flatten)] #[clap(flatten)]
c1: Common, c1: Common,
@ -61,12 +61,12 @@ fn flatten_twice() {
#[test] #[test]
fn flatten_in_subcommand() { fn flatten_in_subcommand() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Common { struct Common {
arg: i32, arg: i32,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Add { struct Add {
#[clap(short)] #[clap(short)]
interactive: bool, interactive: bool,
@ -74,7 +74,7 @@ fn flatten_in_subcommand() {
common: Common, common: Common,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Opt { enum Opt {
Fetch { Fetch {
#[clap(short)] #[clap(short)]
@ -102,23 +102,23 @@ fn flatten_in_subcommand() {
); );
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum BaseCli { enum BaseCli {
Command1(Command1), Command1(Command1),
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Command1 { struct Command1 {
arg1: i32, arg1: i32,
arg2: i32, arg2: i32,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Command2 { struct Command2 {
arg2: i32, arg2: i32,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Opt { enum Opt {
#[clap(flatten)] #[clap(flatten)]
BaseCli(BaseCli), BaseCli(BaseCli),
@ -155,13 +155,13 @@ fn update_subcommands_with_flatten() {
#[test] #[test]
fn flatten_with_doc_comment() { fn flatten_with_doc_comment() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Common { struct Common {
/// This is an arg. Arg means "argument". Command line argument. /// This is an arg. Arg means "argument". Command line argument.
arg: i32, arg: i32,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
/// The very important comment that clippy had me put here. /// The very important comment that clippy had me put here.
/// It knows better. /// It knows better.
@ -183,14 +183,14 @@ fn flatten_with_doc_comment() {
#[test] #[test]
fn docstrings_ordering_with_multiple_clap() { fn docstrings_ordering_with_multiple_clap() {
/// This is the docstring for Flattened /// This is the docstring for Flattened
#[derive(Clap)] #[derive(Parser)]
struct Flattened { struct Flattened {
#[clap(long)] #[clap(long)]
foo: bool, foo: bool,
} }
/// This is the docstring for Command /// This is the docstring for Command
#[derive(Clap)] #[derive(Parser)]
struct Command { struct Command {
#[clap(flatten)] #[clap(flatten)]
flattened: Flattened, flattened: Flattened,
@ -204,13 +204,13 @@ fn docstrings_ordering_with_multiple_clap() {
#[test] #[test]
fn docstrings_ordering_with_multiple_clap_partial() { fn docstrings_ordering_with_multiple_clap_partial() {
/// This is the docstring for Flattened /// This is the docstring for Flattened
#[derive(Clap)] #[derive(Parser)]
struct Flattened { struct Flattened {
#[clap(long)] #[clap(long)]
foo: bool, foo: bool,
} }
#[derive(Clap)] #[derive(Parser)]
struct Command { struct Command {
#[clap(flatten)] #[clap(flatten)]
flattened: Flattened, flattened: Flattened,

View file

@ -3,11 +3,11 @@
mod utils; mod utils;
use utils::*; use utils::*;
use clap::{AppSettings, ArgGroup, Clap}; use clap::{AppSettings, ArgGroup, Parser};
#[test] #[test]
fn issue_151() { fn issue_151() {
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(group = ArgGroup::new("verb").required(true).multiple(true))] #[clap(group = ArgGroup::new("verb").required(true).multiple(true))]
struct Opt { struct Opt {
#[clap(long, group = "verb")] #[clap(long, group = "verb")]
@ -16,7 +16,7 @@ fn issue_151() {
bar: bool, bar: bool,
} }
#[derive(Debug, Clap)] #[derive(Debug, Parser)]
struct Cli { struct Cli {
#[clap(flatten)] #[clap(flatten)]
a: Opt, a: Opt,
@ -31,7 +31,7 @@ fn issue_151() {
#[test] #[test]
fn issue_289() { fn issue_289() {
#[derive(Clap)] #[derive(Parser)]
#[clap(setting = AppSettings::InferSubcommands)] #[clap(setting = AppSettings::InferSubcommands)]
enum Args { enum Args {
SomeCommand { SomeCommand {
@ -43,7 +43,7 @@ fn issue_289() {
// FIXME (@CreepySkeleton): current implementation requires us to // FIXME (@CreepySkeleton): current implementation requires us to
// derive IntoApp here while we don't really need it // derive IntoApp here while we don't really need it
#[derive(Clap)] #[derive(Parser)]
#[clap(setting = AppSettings::InferSubcommands)] #[clap(setting = AppSettings::InferSubcommands)]
enum SubSubCommand { enum SubSubCommand {
TestCommand, TestCommand,
@ -61,14 +61,14 @@ fn issue_324() {
"MY_VERSION" "MY_VERSION"
} }
#[derive(Clap)] #[derive(Parser)]
#[clap(version = my_version())] #[clap(version = my_version())]
struct Opt { struct Opt {
#[clap(subcommand)] #[clap(subcommand)]
_cmd: Option<SubCommand>, _cmd: Option<SubCommand>,
} }
#[derive(Clap)] #[derive(Parser)]
enum SubCommand { enum SubCommand {
Start, Start,
} }
@ -79,7 +79,7 @@ fn issue_324() {
#[test] #[test]
fn issue_490() { fn issue_490() {
use clap::Clap; use clap::Parser;
use std::iter::FromIterator; use std::iter::FromIterator;
use std::str::FromStr; use std::str::FromStr;
@ -96,7 +96,7 @@ fn issue_490() {
} }
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt { struct Opt {
opt_vec: Vec<u16>, opt_vec: Vec<u16>,
#[clap(long)] #[clap(long)]

View file

@ -12,9 +12,9 @@
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the // commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
// MIT/Apache 2.0 license. // MIT/Apache 2.0 license.
use clap::Clap; use clap::Parser;
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, long)] #[clap(short, long)]
force: bool, force: bool,
@ -24,13 +24,13 @@ struct Opt {
cmd: Sub, cmd: Sub,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Sub { enum Sub {
Fetch {}, Fetch {},
Add {}, Add {},
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt2 { struct Opt2 {
#[clap(short, long)] #[clap(short, long)]
force: bool, force: bool,
@ -107,7 +107,7 @@ fn test_badinput() {
assert!(result.is_err()); assert!(result.is_err());
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt3 { struct Opt3 {
#[clap(short, long)] #[clap(short, long)]
all: bool, all: bool,
@ -115,7 +115,7 @@ struct Opt3 {
cmd: Sub2, cmd: Sub2,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Sub2 { enum Sub2 {
Foo { Foo {
file: String, file: String,
@ -125,7 +125,7 @@ enum Sub2 {
Bar {}, Bar {},
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Sub3 { enum Sub3 {
Baz {}, Baz {},
Quux {}, Quux {},
@ -145,7 +145,7 @@ fn test_subsubcommand() {
); );
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum SubSubCmdWithOption { enum SubSubCmdWithOption {
Remote { Remote {
#[clap(subcommand)] #[clap(subcommand)]
@ -156,13 +156,13 @@ enum SubSubCmdWithOption {
cmd: Stash, cmd: Stash,
}, },
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Remote { enum Remote {
Add { name: String, url: String }, Add { name: String, url: String },
Remove { name: String }, Remove { name: String },
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Stash { enum Stash {
Save, Save,
Pop, Pop,

View file

@ -12,7 +12,7 @@
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the // commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
// MIT/Apache 2.0 license. // MIT/Apache 2.0 license.
use clap::Clap; use clap::Parser;
// Tests that clap_derive properly detects an `Option` field // Tests that clap_derive properly detects an `Option` field
// that results from a macro expansion // that results from a macro expansion
@ -20,7 +20,7 @@ use clap::Clap;
fn use_option() { fn use_option() {
macro_rules! expand_ty { macro_rules! expand_ty {
($name:ident: $ty:ty) => { ($name:ident: $ty:ty) => {
#[derive(Clap)] #[derive(Parser)]
struct Outer { struct Outer {
#[clap(short, long)] #[clap(short, long)]
#[allow(dead_code)] #[allow(dead_code)]
@ -38,7 +38,7 @@ fn issue_447() {
( $name:ident, [ ( $name:ident, [
#[$meta:meta] $var:ident($inner:ty) #[$meta:meta] $var:ident($inner:ty)
] ) => { ] ) => {
#[derive(Debug, PartialEq, clap::Clap)] #[derive(Debug, PartialEq, clap::Parser)]
enum $name { enum $name {
#[$meta] #[$meta]
$var($inner), $var($inner),

View file

@ -12,13 +12,13 @@
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the // commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
// MIT/Apache 2.0 license. // MIT/Apache 2.0 license.
use clap::{AppSettings, Clap, ErrorKind}; use clap::{AppSettings, ErrorKind, Parser};
use std::num::ParseIntError; use std::num::ParseIntError;
pub const DISPLAY_ORDER: usize = 2; pub const DISPLAY_ORDER: usize = 2;
// Check if the global settings compile // Check if the global settings compile
#[derive(Clap, Debug, PartialEq, Eq)] #[derive(Parser, Debug, PartialEq, Eq)]
#[clap(global_setting = AppSettings::ColoredHelp)] #[clap(global_setting = AppSettings::ColoredHelp)]
struct Opt { struct Opt {
#[clap( #[clap(
@ -128,7 +128,7 @@ fn parse_hex(input: &str) -> Result<u64, ParseIntError> {
u64::from_str_radix(input, 16) u64::from_str_radix(input, 16)
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct HexOpt { struct HexOpt {
#[clap(short, parse(try_from_str = parse_hex))] #[clap(short, parse(try_from_str = parse_hex))]
number: u64, number: u64,

View file

@ -16,12 +16,12 @@
mod utils; mod utils;
use clap::Clap; use clap::Parser;
use utils::*; use utils::*;
#[test] #[test]
fn required_option() { fn required_option() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, long)] #[clap(short, long)]
arg: i32, arg: i32,
@ -35,7 +35,7 @@ fn required_option() {
#[test] #[test]
fn optional_option() { fn optional_option() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short)] #[clap(short)]
arg: Option<i32>, arg: Option<i32>,
@ -47,7 +47,7 @@ fn optional_option() {
#[test] #[test]
fn option_with_default() { fn option_with_default() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, default_value = "42")] #[clap(short, default_value = "42")]
arg: i32, arg: i32,
@ -59,7 +59,7 @@ fn option_with_default() {
#[test] #[test]
fn option_with_raw_default() { fn option_with_raw_default() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, default_value = "42")] #[clap(short, default_value = "42")]
arg: i32, arg: i32,
@ -71,7 +71,7 @@ fn option_with_raw_default() {
#[test] #[test]
fn options() { fn options() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, long, multiple_occurrences(true))] #[clap(short, long, multiple_occurrences(true))]
arg: Vec<i32>, arg: Vec<i32>,
@ -86,7 +86,7 @@ fn options() {
#[test] #[test]
fn default_value() { fn default_value() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, default_value = "test")] #[clap(short, default_value = "test")]
arg: String, arg: String,
@ -109,7 +109,7 @@ fn option_from_str() {
} }
} }
#[derive(Debug, Clap, PartialEq)] #[derive(Debug, Parser, PartialEq)]
struct Opt { struct Opt {
#[clap(parse(from_str))] #[clap(parse(from_str))]
a: Option<A>, a: Option<A>,
@ -121,7 +121,7 @@ fn option_from_str() {
#[test] #[test]
fn optional_argument_for_optional_option() { fn optional_argument_for_optional_option() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, multiple_occurrences(true))] #[clap(short, multiple_occurrences(true))]
#[allow(clippy::option_option)] #[allow(clippy::option_option)]
@ -140,7 +140,7 @@ fn optional_argument_for_optional_option() {
#[test] #[test]
fn option_option_help() { fn option_option_help() {
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt { struct Opt {
#[clap(long, value_name = "val")] #[clap(long, value_name = "val")]
arg: Option<Option<i32>>, arg: Option<Option<i32>>,
@ -152,7 +152,7 @@ fn option_option_help() {
#[test] #[test]
fn two_option_options() { fn two_option_options() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short)] #[clap(short)]
arg: Option<Option<i32>>, arg: Option<Option<i32>>,
@ -206,7 +206,7 @@ fn two_option_options() {
#[test] #[test]
fn optional_vec() { fn optional_vec() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, multiple_occurrences(true))] #[clap(short, multiple_occurrences(true))]
arg: Option<Vec<i32>>, arg: Option<Vec<i32>>,
@ -263,7 +263,7 @@ fn optional_vec() {
#[test] #[test]
fn two_optional_vecs() { fn two_optional_vecs() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(short, multiple_occurrences(true))] #[clap(short, multiple_occurrences(true))]
arg: Option<Vec<i32>>, arg: Option<Vec<i32>>,
@ -301,7 +301,7 @@ fn two_optional_vecs() {
#[test] #[test]
fn required_option_type() { fn required_option_type() {
#[derive(Debug, PartialEq, Eq, Clap)] #[derive(Debug, PartialEq, Eq, Parser)]
#[clap(setting(clap::AppSettings::SubcommandsNegateReqs))] #[clap(setting(clap::AppSettings::SubcommandsNegateReqs))]
struct Opt { struct Opt {
#[clap(required = true)] #[clap(required = true)]
@ -311,7 +311,7 @@ fn required_option_type() {
cmd: Option<SubCommands>, cmd: Option<SubCommands>,
} }
#[derive(Debug, PartialEq, Eq, Clap)] #[derive(Debug, PartialEq, Eq, Parser)]
enum SubCommands { enum SubCommands {
ExSub { ExSub {
#[clap(short, long, parse(from_occurrences))] #[clap(short, long, parse(from_occurrences))]

View file

@ -13,9 +13,9 @@
// MIT/Apache 2.0 license. // MIT/Apache 2.0 license.
mod options { mod options {
use clap::Clap; use clap::Parser;
#[derive(Debug, Clap)] #[derive(Debug, Parser)]
pub struct Options { pub struct Options {
#[clap(subcommand)] #[clap(subcommand)]
pub subcommand: super::subcommands::SubCommand, pub subcommand: super::subcommands::SubCommand,
@ -23,9 +23,9 @@ mod options {
} }
mod subcommands { mod subcommands {
use clap::Clap; use clap::Parser;
#[derive(Debug, Clap)] #[derive(Debug, Parser)]
pub enum SubCommand { pub enum SubCommand {
/// foo /// foo
Foo { Foo {

View file

@ -6,11 +6,11 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[test] #[test]
fn raw_bool_literal() { fn raw_bool_literal() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
#[clap(name = "raw_bool")] #[clap(name = "raw_bool")]
struct Opt { struct Opt {
#[clap(raw(false))] #[clap(raw(false))]

View file

@ -1,8 +1,8 @@
use clap::Clap; use clap::Parser;
#[test] #[test]
fn raw_idents() { fn raw_idents() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(short, long, multiple_occurrences(true))] #[clap(short, long, multiple_occurrences(true))]
r#type: Vec<String>, r#type: Vec<String>,

View file

@ -1,11 +1,11 @@
mod utils; mod utils;
use clap::Clap; use clap::Parser;
use utils::*; use utils::*;
#[test] #[test]
fn it_works() { fn it_works() {
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
#[clap(rename_all_env = "kebab")] #[clap(rename_all_env = "kebab")]
struct BehaviorModel { struct BehaviorModel {
#[clap(env)] #[clap(env)]
@ -18,7 +18,7 @@ fn it_works() {
#[test] #[test]
fn default_is_screaming() { fn default_is_screaming() {
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
struct BehaviorModel { struct BehaviorModel {
#[clap(env)] #[clap(env)]
be_nice: String, be_nice: String,
@ -30,7 +30,7 @@ fn default_is_screaming() {
#[test] #[test]
fn overridable() { fn overridable() {
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
#[clap(rename_all_env = "kebab")] #[clap(rename_all_env = "kebab")]
struct BehaviorModel { struct BehaviorModel {
#[clap(env)] #[clap(env)]

View file

@ -6,11 +6,11 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[test] #[test]
fn skip_1() { fn skip_1() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(short)] #[clap(short)]
x: u32, x: u32,
@ -37,7 +37,7 @@ fn skip_1() {
#[test] #[test]
fn skip_2() { fn skip_2() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
struct Opt { struct Opt {
#[clap(short)] #[clap(short)]
x: u32, x: u32,
@ -79,7 +79,7 @@ fn skip_enum() {
} }
} }
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
pub struct Opt { pub struct Opt {
#[clap(long, short)] #[clap(long, short)]
number: u32, number: u32,
@ -101,7 +101,7 @@ fn skip_enum() {
#[test] #[test]
fn skip_help_doc_comments() { fn skip_help_doc_comments() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
pub struct Opt { pub struct Opt {
#[clap(skip, about = "internal_stuff")] #[clap(skip, about = "internal_stuff")]
a: u32, a: u32,
@ -132,7 +132,7 @@ fn skip_help_doc_comments() {
#[test] #[test]
fn skip_val() { fn skip_val() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
pub struct Opt { pub struct Opt {
#[clap(long, short)] #[clap(long, short)]
number: u32, number: u32,

View file

@ -1,6 +1,6 @@
//! Checks that types like `::std::option::Option` are not special //! Checks that types like `::std::option::Option` are not special
use clap::Clap; use clap::Parser;
#[rustversion::all(since(1.37), stable)] #[rustversion::all(since(1.37), stable)]
#[test] #[test]
@ -19,7 +19,7 @@ fn special_types_bool() {
} }
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
arg: inner::bool, arg: inner::bool,
} }
@ -38,7 +38,7 @@ fn special_types_option() {
Some(s.to_string()) Some(s.to_string())
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(parse(from_str = parser))] #[clap(parse(from_str = parser))]
arg: ::std::option::Option<String>, arg: ::std::option::Option<String>,
@ -58,7 +58,7 @@ fn special_types_vec() {
vec![s.to_string()] vec![s.to_string()]
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(parse(from_str = parser))] #[clap(parse(from_str = parser))]
arg: ::std::vec::Vec<String>, arg: ::std::vec::Vec<String>,

View file

@ -14,10 +14,10 @@
mod utils; mod utils;
use clap::Clap; use clap::Parser;
use utils::*; use utils::*;
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Opt { enum Opt {
/// Fetch stuff from GitHub /// Fetch stuff from GitHub
Fetch { Fetch {
@ -87,7 +87,7 @@ fn test_no_parse() {
assert!(result.is_err()); assert!(result.is_err());
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Opt2 { enum Opt2 {
DoSomething { arg: String }, DoSomething { arg: String },
} }
@ -104,7 +104,7 @@ fn test_hyphenated_subcommands() {
); );
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Opt3 { enum Opt3 {
Add, Add,
Init, Init,
@ -118,17 +118,17 @@ fn test_null_commands() {
assert_eq!(Opt3::Fetch, Opt3::parse_from(&["test", "fetch"])); assert_eq!(Opt3::Fetch, Opt3::parse_from(&["test", "fetch"]));
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
#[clap(about = "Not shown")] #[clap(about = "Not shown")]
struct Add { struct Add {
file: String, file: String,
} }
/// Not shown /// Not shown
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Fetch { struct Fetch {
remote: String, remote: String,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Opt4 { enum Opt4 {
// Not shown // Not shown
/// Add a file /// Add a file
@ -163,7 +163,7 @@ fn test_tuple_commands() {
#[test] #[test]
fn global_passed_down() { fn global_passed_down() {
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
struct Opt { struct Opt {
#[clap(global = true, long)] #[clap(global = true, long)]
other: bool, other: bool,
@ -171,13 +171,13 @@ fn global_passed_down() {
sub: Subcommands, sub: Subcommands,
} }
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
enum Subcommands { enum Subcommands {
Add, Add,
Global(GlobalCmd), Global(GlobalCmd),
} }
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
struct GlobalCmd { struct GlobalCmd {
#[clap(from_global)] #[clap(from_global)]
other: bool, other: bool,
@ -202,13 +202,13 @@ fn global_passed_down() {
#[test] #[test]
fn external_subcommand() { fn external_subcommand() {
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
struct Opt { struct Opt {
#[clap(subcommand)] #[clap(subcommand)]
sub: Subcommands, sub: Subcommands,
} }
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
enum Subcommands { enum Subcommands {
Add, Add,
Remove, Remove,
@ -244,13 +244,13 @@ fn external_subcommand() {
fn external_subcommand_os_string() { fn external_subcommand_os_string() {
use std::ffi::OsString; use std::ffi::OsString;
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
struct Opt { struct Opt {
#[clap(subcommand)] #[clap(subcommand)]
sub: Subcommands, sub: Subcommands,
} }
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
enum Subcommands { enum Subcommands {
#[clap(external_subcommand)] #[clap(external_subcommand)]
Other(Vec<OsString>), Other(Vec<OsString>),
@ -268,13 +268,13 @@ fn external_subcommand_os_string() {
#[test] #[test]
fn external_subcommand_optional() { fn external_subcommand_optional() {
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
struct Opt { struct Opt {
#[clap(subcommand)] #[clap(subcommand)]
sub: Option<Subcommands>, sub: Option<Subcommands>,
} }
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
enum Subcommands { enum Subcommands {
#[clap(external_subcommand)] #[clap(external_subcommand)]
Other(Vec<String>), Other(Vec<String>),
@ -292,13 +292,13 @@ fn external_subcommand_optional() {
#[test] #[test]
fn enum_in_enum_subsubcommand() { fn enum_in_enum_subsubcommand() {
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
pub enum Opt { pub enum Opt {
#[clap(subcommand)] #[clap(subcommand)]
Daemon(DaemonCommand), Daemon(DaemonCommand),
} }
#[derive(Clap, Debug, PartialEq)] #[derive(Parser, Debug, PartialEq)]
pub enum DaemonCommand { pub enum DaemonCommand {
Start, Start,
Stop, Stop,
@ -316,19 +316,19 @@ fn enum_in_enum_subsubcommand() {
#[test] #[test]
fn update_subcommands() { fn update_subcommands() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Opt { enum Opt {
Command1(Command1), Command1(Command1),
Command2(Command2), Command2(Command2),
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Command1 { struct Command1 {
arg1: i32, arg1: i32,
arg2: i32, arg2: i32,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Command2 { struct Command2 {
arg2: i32, arg2: i32,
} }
@ -352,7 +352,7 @@ fn update_subcommands() {
#[test] #[test]
fn update_sub_subcommands() { fn update_sub_subcommands() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Opt { enum Opt {
#[clap(subcommand)] #[clap(subcommand)]
Child1(Child1), Child1(Child1),
@ -360,25 +360,25 @@ fn update_sub_subcommands() {
Child2(Child2), Child2(Child2),
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Child1 { enum Child1 {
Command1(Command1), Command1(Command1),
Command2(Command2), Command2(Command2),
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Child2 { enum Child2 {
Command1(Command1), Command1(Command1),
Command2(Command2), Command2(Command2),
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Command1 { struct Command1 {
arg1: i32, arg1: i32,
arg2: i32, arg2: i32,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Command2 { struct Command2 {
arg2: i32, arg2: i32,
} }
@ -416,7 +416,7 @@ fn update_sub_subcommands() {
#[test] #[test]
fn update_ext_subcommand() { fn update_ext_subcommand() {
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum Opt { enum Opt {
Command1(Command1), Command1(Command1),
Command2(Command2), Command2(Command2),
@ -424,13 +424,13 @@ fn update_ext_subcommand() {
Ext(Vec<String>), Ext(Vec<String>),
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Command1 { struct Command1 {
arg1: i32, arg1: i32,
arg2: i32, arg2: i32,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Command2 { struct Command2 {
arg2: i32, arg2: i32,
} }
@ -460,13 +460,13 @@ fn subcommand_name_not_literal() {
"renamed" "renamed"
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
struct Opt { struct Opt {
#[clap(subcommand)] #[clap(subcommand)]
subcmd: SubCmd, subcmd: SubCmd,
} }
#[derive(Clap, PartialEq, Debug)] #[derive(Parser, PartialEq, Debug)]
enum SubCmd { enum SubCmd {
#[clap(name = get_name())] #[clap(name = get_name())]
SubCmd1, SubCmd1,
@ -477,13 +477,13 @@ fn subcommand_name_not_literal() {
#[test] #[test]
fn skip_subcommand() { fn skip_subcommand() {
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
struct Opt { struct Opt {
#[clap(subcommand)] #[clap(subcommand)]
sub: Subcommands, sub: Subcommands,
} }
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
enum Subcommands { enum Subcommands {
Add, Add,
Remove, Remove,

View file

@ -1,6 +1,6 @@
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(short, arg_enum)] #[clap(short, arg_enum)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(short, default_value = true)] #[clap(short, default_value = true)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(short, required = true)] #[clap(short, required = true)]

View file

@ -1,10 +1,10 @@
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap] #[clap]
struct Opt {} struct Opt {}
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt1 { struct Opt1 {
#[clap = "short"] #[clap = "short"]
foo: u32, foo: u32,

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(default_value_t = -10)] #[clap(default_value_t = -10)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(default_value)] #[clap(default_value)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
enum Opt { enum Opt {
#[clap(flatten)] #[clap(flatten)]

View file

@ -1,9 +1,9 @@
#[derive(clap::Clap)] #[derive(clap::Parser)]
enum Opt { enum Opt {
Sub(SubCmd), Sub(SubCmd),
} }
#[derive(clap::Clap)] #[derive(clap::Parser)]
enum SubCmd {} enum SubCmd {}
fn main() {} fn main() {}

View file

@ -1,6 +1,6 @@
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt { struct Opt {
#[clap(external_subcommand)] #[clap(external_subcommand)]
field: String, field: String,

View file

@ -1,19 +1,19 @@
use clap::Clap; use clap::Parser;
use std::ffi::CString; use std::ffi::CString;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Opt { enum Opt {
#[clap(external_subcommand)] #[clap(external_subcommand)]
Other(Vec<CString>), Other(Vec<CString>),
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Opt2 { enum Opt2 {
#[clap(external_subcommand)] #[clap(external_subcommand)]
Other(String), Other(String),
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Opt3 { enum Opt3 {
#[clap(external_subcommand)] #[clap(external_subcommand)]
Other { a: String }, Other { a: String },

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct DaemonOpts { struct DaemonOpts {
#[clap(short)] #[clap(short)]
user: String, user: String,
@ -16,7 +16,7 @@ struct DaemonOpts {
group: String, group: String,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(short, flatten)] #[clap(short, flatten)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct DaemonOpts { struct DaemonOpts {
#[clap(short)] #[clap(short)]
user: String, user: String,
@ -16,7 +16,7 @@ struct DaemonOpts {
group: String, group: String,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(flatten, parse(from_occurrences))] #[clap(flatten, parse(from_occurrences))]

View file

@ -1,10 +1,10 @@
#[derive(clap::Clap)] #[derive(clap::Parser)]
struct Opt { struct Opt {
#[clap(flatten)] #[clap(flatten)]
sub: SubCmd, sub: SubCmd,
} }
#[derive(clap::Clap)] #[derive(clap::Parser)]
enum SubCmd {} enum SubCmd {}
fn main() {} fn main() {}

View file

@ -1,12 +1,12 @@
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt { struct Opt {
#[clap(subcommand)] #[clap(subcommand)]
cmd: Command, cmd: Command,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Command { enum Command {
#[clap(external_subcommand)] #[clap(external_subcommand)]
Run(Vec<String>), Run(Vec<String>),

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(short, non_existing_attribute = 1)] #[clap(short, non_existing_attribute = 1)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
n: Option<Option<u32>>, n: Option<Option<u32>>,

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
n: Option<Vec<u32>>, n: Option<Vec<u32>>,

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(short, default_value = 1)] #[clap(short, default_value = 1)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(parse(try_from_os_str))] #[clap(parse(try_from_os_str))]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(parse(from_str = "2"))] #[clap(parse(from_str = "2"))]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(parse("from_str"))] #[clap(parse("from_str"))]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt { struct Opt {
#[clap(parse(from_str, from_str))] #[clap(parse(from_str, from_str))]

View file

@ -1,6 +1,6 @@
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt { struct Opt {
verbose: bool, verbose: bool,
} }

View file

@ -6,15 +6,15 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt { struct Opt {
#[clap(raw(case_insensitive = "true"))] #[clap(raw(case_insensitive = "true"))]
s: String, s: String,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct Opt2 { struct Opt2 {
#[clap(raw(requires_if = r#""one", "two""#))] #[clap(raw(requires_if = r#""one", "two""#))]
s: String, s: String,

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic", rename_all = "fail")] #[clap(name = "basic", rename_all = "fail")]
struct Opt { struct Opt {
#[clap(short)] #[clap(short)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "make-cookie")] #[clap(name = "make-cookie")]
struct MakeCookie { struct MakeCookie {
#[clap(short)] #[clap(short)]
@ -18,7 +18,7 @@ struct MakeCookie {
cmd: Command, cmd: Command,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Command { enum Command {
#[clap(name = "pound")] #[clap(name = "pound")]
/// Pound acorns into flour for cookie dough. /// Pound acorns into flour for cookie dough.

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "make-cookie")] #[clap(name = "make-cookie")]
struct MakeCookie { struct MakeCookie {
#[clap(short)] #[clap(short)]
@ -18,7 +18,7 @@ struct MakeCookie {
cmd: Command, cmd: Command,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Command { enum Command {
#[clap(name = "pound")] #[clap(name = "pound")]
/// Pound acorns into flour for cookie dough. /// Pound acorns into flour for cookie dough.

View file

@ -1,6 +1,6 @@
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "test")] #[clap(name = "test")]
pub struct Opt { pub struct Opt {
#[clap(long)] #[clap(long)]

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Debug)] #[derive(Debug)]
enum Kind { enum Kind {
@ -14,7 +14,7 @@ enum Kind {
B, B,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "test")] #[clap(name = "test")]
pub struct Opt { pub struct Opt {
#[clap(short)] #[clap(short)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic", parse(from_str))] #[clap(name = "basic", parse(from_str))]
struct Opt { struct Opt {
#[clap(short)] #[clap(short)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic", subcommand)] #[clap(name = "basic", subcommand)]
struct Opt { struct Opt {
#[clap(short)] #[clap(short)]

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct MakeCookie { struct MakeCookie {
#[clap(short)] #[clap(short)]
s: String, s: String,
@ -17,7 +17,7 @@ struct MakeCookie {
cmd: Command, cmd: Command,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Command { enum Command {
/// Pound acorns into flour for cookie dough. /// Pound acorns into flour for cookie dough.
Pound { acorns: u32 }, Pound { acorns: u32 },

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct MakeCookie { struct MakeCookie {
#[clap(short)] #[clap(short)]
s: String, s: String,
@ -17,7 +17,7 @@ struct MakeCookie {
cmd: Command, cmd: Command,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Command { enum Command {
/// Pound acorns into flour for cookie dough. /// Pound acorns into flour for cookie dough.
Pound { acorns: u32 }, Pound { acorns: u32 },

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct MakeCookie { struct MakeCookie {
#[clap(short)] #[clap(short)]
s: String, s: String,
@ -17,7 +17,7 @@ struct MakeCookie {
cmd: Command, cmd: Command,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Command { enum Command {
/// Pound acorns into flour for cookie dough. /// Pound acorns into flour for cookie dough.
Pound { acorns: u32 }, Pound { acorns: u32 },

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct MakeCookie { struct MakeCookie {
#[clap(short)] #[clap(short)]
s: String, s: String,
@ -17,7 +17,7 @@ struct MakeCookie {
cmd: Option<Option<Command>>, cmd: Option<Option<Command>>,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Command { enum Command {
/// Pound acorns into flour for cookie dough. /// Pound acorns into flour for cookie dough.
Pound { acorns: u32 }, Pound { acorns: u32 },

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
struct MakeCookie { struct MakeCookie {
#[clap(short)] #[clap(short)]
s: String, s: String,
@ -17,7 +17,7 @@ struct MakeCookie {
cmd: Option<Vec<Command>>, cmd: Option<Vec<Command>>,
} }
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
enum Command { enum Command {
/// Pound acorns into flour for cookie dough. /// Pound acorns into flour for cookie dough.
Pound { acorns: u32 }, Pound { acorns: u32 },

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use clap::Clap; use clap::Parser;
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "basic")] #[clap(name = "basic")]
struct Opt(u32); struct Opt(u32);

View file

@ -1,10 +1,10 @@
error: `#[derive(Clap)]` only supports non-tuple structs and enums error: `#[derive(Parser)]` only supports non-tuple structs and enums
--> $DIR/tuple_struct.rs:11:10 --> $DIR/tuple_struct.rs:11:10
| |
11 | #[derive(Clap, Debug)] 11 | #[derive(Parser, Debug)]
| ^^^^ | ^^^^^^
| |
= note: this error originates in the derive macro `Clap` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `Parser` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: no function or associated item named `parse` found for struct `Opt` in the current scope error[E0599]: no function or associated item named `parse` found for struct `Opt` in the current scope
--> $DIR/tuple_struct.rs:16:20 --> $DIR/tuple_struct.rs:16:20
@ -17,4 +17,4 @@ error[E0599]: no function or associated item named `parse` found for struct `Opt
| |
= help: items from traits can only be used if the trait is implemented and in scope = help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `parse`, perhaps you need to implement it: = note: the following trait defines an item `parse`, perhaps you need to implement it:
candidate #1: `Clap` candidate #1: `Parser`

View file

@ -1,15 +1,15 @@
#![cfg(not(windows))] #![cfg(not(windows))]
use clap::{Clap, ErrorKind}; use clap::{ErrorKind, Parser};
use std::ffi::OsString; use std::ffi::OsString;
use std::os::unix::ffi::OsStringExt; use std::os::unix::ffi::OsStringExt;
#[derive(Clap, Debug, PartialEq, Eq)] #[derive(Parser, Debug, PartialEq, Eq)]
struct Positional { struct Positional {
arg: String, arg: String,
} }
#[derive(Clap, Debug, PartialEq, Eq)] #[derive(Parser, Debug, PartialEq, Eq)]
struct Named { struct Named {
#[clap(short, long)] #[clap(short, long)]
arg: String, arg: String,
@ -74,13 +74,13 @@ fn invalid_utf8_strict_option_long_equals() {
assert_eq!(m.unwrap_err().kind, ErrorKind::InvalidUtf8); assert_eq!(m.unwrap_err().kind, ErrorKind::InvalidUtf8);
} }
#[derive(Clap, Debug, PartialEq, Eq)] #[derive(Parser, Debug, PartialEq, Eq)]
struct PositionalOs { struct PositionalOs {
#[clap(parse(from_os_str))] #[clap(parse(from_os_str))]
arg: OsString, arg: OsString,
} }
#[derive(Clap, Debug, PartialEq, Eq)] #[derive(Parser, Debug, PartialEq, Eq)]
struct NamedOs { struct NamedOs {
#[clap(short, long, parse(from_os_str))] #[clap(short, long, parse(from_os_str))]
arg: OsString, arg: OsString,
@ -169,7 +169,7 @@ fn invalid_utf8_option_long_equals() {
); );
} }
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
enum External { enum External {
#[clap(external_subcommand)] #[clap(external_subcommand)]
Other(Vec<String>), Other(Vec<String>),
@ -199,7 +199,7 @@ fn refuse_invalid_utf8_subcommand_args_with_allow_external_subcommands() {
assert_eq!(m.unwrap_err().kind, ErrorKind::InvalidUtf8); assert_eq!(m.unwrap_err().kind, ErrorKind::InvalidUtf8);
} }
#[derive(Debug, PartialEq, Clap)] #[derive(Debug, PartialEq, Parser)]
enum ExternalOs { enum ExternalOs {
#[clap(external_subcommand)] #[clap(external_subcommand)]
Other(Vec<OsString>), Other(Vec<OsString>),

View file

@ -7,10 +7,10 @@ title = "Fast & Modern CLI Framework for Rust"
Here is an example of a simple program: Here is an example of a simple program:
```rust ```rust
use clap::Clap; use clap::Parser;
/// Simple program to greet a person /// Simple program to greet a person
#[derive(Clap, Debug)] #[derive(Parser, Debug)]
#[clap(name = "hello")] #[clap(name = "hello")]
struct Hello { struct Hello {
/// Name of the person to greet /// Name of the person to greet

View file

@ -26,9 +26,8 @@ use std::ffi::OsString;
/// the CLI. /// the CLI.
/// ///
/// ```rust /// ```rust
/// # use clap::{Clap};
/// /// My super CLI /// /// My super CLI
/// #[derive(Clap)] /// #[derive(clap::Parser)]
/// #[clap(name = "demo")] /// #[clap(name = "demo")]
/// struct Context { /// struct Context {
/// /// More verbose output /// /// More verbose output
@ -70,7 +69,7 @@ use std::ffi::OsString;
/// } /// }
/// ``` /// ```
/// ///
pub trait Clap: FromArgMatches + IntoApp + Sized { pub trait Parser: FromArgMatches + IntoApp + Sized {
/// Parse from `std::env::args_os()`, exit on error /// Parse from `std::env::args_os()`, exit on error
fn parse() -> Self { fn parse() -> Self {
let matches = <Self as IntoApp>::into_app().get_matches(); let matches = <Self as IntoApp>::into_app().get_matches();
@ -194,7 +193,7 @@ pub trait FromArgMatches: Sized {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// #[derive(clap::Clap)] /// #[derive(clap::Parser)]
/// struct Args { /// struct Args {
/// #[clap(flatten)] /// #[clap(flatten)]
/// logging: LogArgs, /// logging: LogArgs,
@ -231,7 +230,7 @@ pub trait Args: FromArgMatches + Sized {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// #[derive(clap::Clap)] /// #[derive(clap::Parser)]
/// struct Args { /// struct Args {
/// #[clap(subcommand)] /// #[clap(subcommand)]
/// action: Action, /// action: Action,
@ -260,14 +259,14 @@ pub trait Subcommand: FromArgMatches + Sized {
/// Parse arguments into enums. /// Parse arguments into enums.
/// ///
/// When deriving [`Clap`], a field whose type implements `ArgEnum` can have the attribute /// When deriving [`Parser`], a field whose type implements `ArgEnum` can have the attribute
/// `#[clap(arg_enum)]`. In addition to parsing, help and error messages may report possible /// `#[clap(arg_enum)]`. In addition to parsing, help and error messages may report possible
/// variants. /// variants.
/// ///
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// #[derive(clap::Clap)] /// #[derive(clap::Parser)]
/// struct Args { /// struct Args {
/// #[clap(arg_enum)] /// #[clap(arg_enum)]
/// level: Level, /// level: Level,
@ -304,13 +303,13 @@ pub trait ArgEnum: Sized + Clone {
fn to_arg_value<'a>(&self) -> Option<ArgValue<'a>>; fn to_arg_value<'a>(&self) -> Option<ArgValue<'a>>;
} }
impl<T: Clap> Clap for Box<T> { impl<T: Parser> Parser for Box<T> {
fn parse() -> Self { fn parse() -> Self {
Box::new(<T as Clap>::parse()) Box::new(<T as Parser>::parse())
} }
fn try_parse() -> Result<Self, Error> { fn try_parse() -> Result<Self, Error> {
<T as Clap>::try_parse().map(Box::new) <T as Parser>::try_parse().map(Box::new)
} }
fn parse_from<I, It>(itr: I) -> Self fn parse_from<I, It>(itr: I) -> Self
@ -319,7 +318,7 @@ impl<T: Clap> Clap for Box<T> {
// TODO (@CreepySkeleton): discover a way to avoid cloning here // TODO (@CreepySkeleton): discover a way to avoid cloning here
It: Into<OsString> + Clone, It: Into<OsString> + Clone,
{ {
Box::new(<T as Clap>::parse_from(itr)) Box::new(<T as Parser>::parse_from(itr))
} }
fn try_parse_from<I, It>(itr: I) -> Result<Self, Error> fn try_parse_from<I, It>(itr: I) -> Result<Self, Error>
@ -328,7 +327,7 @@ impl<T: Clap> Clap for Box<T> {
// TODO (@CreepySkeleton): discover a way to avoid cloning here // TODO (@CreepySkeleton): discover a way to avoid cloning here
It: Into<OsString> + Clone, It: Into<OsString> + Clone,
{ {
<T as Clap>::try_parse_from(itr).map(Box::new) <T as Parser>::try_parse_from(itr).map(Box::new)
} }
} }

View file

@ -32,7 +32,7 @@ pub use crate::{
}; };
#[cfg(feature = "derive")] #[cfg(feature = "derive")]
pub use crate::derive::{ArgEnum, Args, Clap, FromArgMatches, IntoApp, Subcommand}; pub use crate::derive::{ArgEnum, Args, FromArgMatches, IntoApp, Parser, Subcommand};
#[cfg(feature = "yaml")] #[cfg(feature = "yaml")]
#[doc(hidden)] #[doc(hidden)]