From dc0db358abe19481e475e10c32149b53370f1a1c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:31 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- .../examples/tutorial_derive/01_quick.md | 37 --------- .../examples/tutorial_derive/01_quick.rs | 69 ---------------- .../examples/tutorial_derive/02_app_settings.md | 19 ----- .../examples/tutorial_derive/02_app_settings.rs | 19 ----- .../examples/tutorial_derive/02_apps.md | 19 ----- .../examples/tutorial_derive/02_apps.rs | 20 ----- .../examples/tutorial_derive/02_crate.md | 18 ----- .../examples/tutorial_derive/02_crate.rs | 17 ---- .../examples/tutorial_derive/03_01_flag_bool.md | 23 ------ .../examples/tutorial_derive/03_01_flag_bool.rs | 14 ---- .../examples/tutorial_derive/03_01_flag_count.md | 23 ------ .../examples/tutorial_derive/03_01_flag_count.rs | 14 ---- .../examples/tutorial_derive/03_02_option.md | 32 -------- .../examples/tutorial_derive/03_02_option.rs | 14 ---- .../examples/tutorial_derive/03_03_positional.md | 22 ----- .../examples/tutorial_derive/03_03_positional.rs | 14 ---- .../examples/tutorial_derive/03_04_subcommands.md | 64 --------------- .../examples/tutorial_derive/03_04_subcommands.rs | 30 ------- .../tutorial_derive/03_04_subcommands_alt.rs | 33 -------- .../tutorial_derive/03_05_default_values.md | 22 ----- .../tutorial_derive/03_05_default_values.rs | 14 ---- .../examples/tutorial_derive/04_01_enum.md | 29 ------- .../examples/tutorial_derive/04_01_enum.rs | 28 ------- .../examples/tutorial_derive/04_02_parse.md | 31 -------- .../examples/tutorial_derive/04_02_parse.rs | 15 ---- .../examples/tutorial_derive/04_02_validate.md | 31 -------- .../examples/tutorial_derive/04_02_validate.rs | 34 -------- .../examples/tutorial_derive/04_03_relations.md | 58 -------------- .../examples/tutorial_derive/04_03_relations.rs | 72 ----------------- .../examples/tutorial_derive/04_04_custom.md | 57 ------------- .../examples/tutorial_derive/04_04_custom.rs | 93 ---------------------- .../examples/tutorial_derive/05_01_assert.rs | 21 ----- 32 files changed, 1006 deletions(-) delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/01_quick.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/01_quick.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/02_app_settings.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/02_app_settings.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/02_apps.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/02_apps.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/02_crate.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/02_crate.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_bool.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_bool.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_count.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_count.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_02_option.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_02_option.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_03_positional.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_03_positional.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands_alt.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_05_default_values.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/03_05_default_values.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/04_01_enum.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/04_01_enum.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/04_02_parse.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/04_02_parse.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/04_02_validate.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/04_02_validate.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/04_03_relations.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/04_03_relations.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/04_04_custom.md delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/04_04_custom.rs delete mode 100644 vendor/clap-3.2.20/examples/tutorial_derive/05_01_assert.rs (limited to 'vendor/clap-3.2.20/examples/tutorial_derive') diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/01_quick.md b/vendor/clap-3.2.20/examples/tutorial_derive/01_quick.md deleted file mode 100644 index 6f70d2cce..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/01_quick.md +++ /dev/null @@ -1,37 +0,0 @@ -```console -$ 01_quick_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 01_quick_derive[EXE] [OPTIONS] [NAME] [SUBCOMMAND] - -ARGS: - Optional name to operate on - -OPTIONS: - -c, --config Sets a custom config file - -d, --debug Turn debugging information on - -h, --help Print help information - -V, --version Print version information - -SUBCOMMANDS: - help Print this message or the help of the given subcommand(s) - test does testing things - -``` - -By default, the program does nothing: -```console -$ 01_quick_derive -Debug mode is off - -``` - -But you can mix and match the various features -```console -$ 01_quick_derive -dd test -Debug mode is on -Not printing testing lists... - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/01_quick.rs b/vendor/clap-3.2.20/examples/tutorial_derive/01_quick.rs deleted file mode 100644 index 2c2031061..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/01_quick.rs +++ /dev/null @@ -1,69 +0,0 @@ -use std::path::PathBuf; - -use clap::{Parser, Subcommand}; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - /// Optional name to operate on - #[clap(value_parser)] - name: Option, - - /// Sets a custom config file - #[clap(short, long, value_parser, value_name = "FILE")] - config: Option, - - /// Turn debugging information on - #[clap(short, long, action = clap::ArgAction::Count)] - debug: u8, - - #[clap(subcommand)] - command: Option, -} - -#[derive(Subcommand)] -enum Commands { - /// does testing things - Test { - /// lists test values - #[clap(short, long, action)] - list: bool, - }, -} - -fn main() { - let cli = Cli::parse(); - - // You can check the value provided by positional arguments, or option arguments - if let Some(name) = cli.name.as_deref() { - println!("Value for name: {}", name); - } - - if let Some(config_path) = cli.config.as_deref() { - println!("Value for config: {}", config_path.display()); - } - - // You can see how many times a particular flag or argument occurred - // Note, only flags can have multiple occurrences - match cli.debug { - 0 => println!("Debug mode is off"), - 1 => println!("Debug mode is kind of on"), - 2 => println!("Debug mode is on"), - _ => println!("Don't be crazy"), - } - - // You can check for the existence of subcommands, and if found use their - // matches just as you would the top level cmd - match &cli.command { - Some(Commands::Test { list }) => { - if *list { - println!("Printing testing lists..."); - } else { - println!("Not printing testing lists..."); - } - } - None => {} - } - - // Continued program logic goes here... -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/02_app_settings.md b/vendor/clap-3.2.20/examples/tutorial_derive/02_app_settings.md deleted file mode 100644 index ee16c66df..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/02_app_settings.md +++ /dev/null @@ -1,19 +0,0 @@ -```console -$ 02_app_settings_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 02_app_settings_derive[EXE] --two --one - -OPTIONS: - --two - --one - -h, --help Print help information - -V, --version Print version information - -$ 02_app_settings_derive --one -1 --one -3 --two 10 -two: "10" -one: "-3" - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/02_app_settings.rs b/vendor/clap-3.2.20/examples/tutorial_derive/02_app_settings.rs deleted file mode 100644 index 6a06929bb..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/02_app_settings.rs +++ /dev/null @@ -1,19 +0,0 @@ -use clap::{AppSettings, Parser}; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -#[clap(allow_negative_numbers = true)] -#[clap(global_setting(AppSettings::DeriveDisplayOrder))] -struct Cli { - #[clap(long, value_parser)] - two: String, - #[clap(long, value_parser)] - one: String, -} - -fn main() { - let cli = Cli::parse(); - - println!("two: {:?}", cli.two); - println!("one: {:?}", cli.one); -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/02_apps.md b/vendor/clap-3.2.20/examples/tutorial_derive/02_apps.md deleted file mode 100644 index 0141581c4..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/02_apps.md +++ /dev/null @@ -1,19 +0,0 @@ -```console -$ 02_apps_derive --help -MyApp 1.0 -Kevin K. -Does awesome things - -USAGE: - 02_apps_derive[EXE] --two --one - -OPTIONS: - -h, --help Print help information - --one - --two - -V, --version Print version information - -$ 02_apps_derive --version -MyApp 1.0 - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/02_apps.rs b/vendor/clap-3.2.20/examples/tutorial_derive/02_apps.rs deleted file mode 100644 index b97ce1eed..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/02_apps.rs +++ /dev/null @@ -1,20 +0,0 @@ -use clap::Parser; - -#[derive(Parser)] -#[clap(name = "MyApp")] -#[clap(author = "Kevin K. ")] -#[clap(version = "1.0")] -#[clap(about = "Does awesome things", long_about = None)] -struct Cli { - #[clap(long, value_parser)] - two: String, - #[clap(long, value_parser)] - one: String, -} - -fn main() { - let cli = Cli::parse(); - - println!("two: {:?}", cli.two); - println!("one: {:?}", cli.one); -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/02_crate.md b/vendor/clap-3.2.20/examples/tutorial_derive/02_crate.md deleted file mode 100644 index 92c820758..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/02_crate.md +++ /dev/null @@ -1,18 +0,0 @@ -```console -$ 02_crate_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 02_crate_derive[EXE] --two --one - -OPTIONS: - -h, --help Print help information - --one - --two - -V, --version Print version information - -$ 02_crate_derive --version -clap [..] - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/02_crate.rs b/vendor/clap-3.2.20/examples/tutorial_derive/02_crate.rs deleted file mode 100644 index 5576f998c..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/02_crate.rs +++ /dev/null @@ -1,17 +0,0 @@ -use clap::Parser; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] // Read from `Cargo.toml` -struct Cli { - #[clap(long, value_parser)] - two: String, - #[clap(long, value_parser)] - one: String, -} - -fn main() { - let cli = Cli::parse(); - - println!("two: {:?}", cli.two); - println!("one: {:?}", cli.one); -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_bool.md b/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_bool.md deleted file mode 100644 index 0baaa10ca..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_bool.md +++ /dev/null @@ -1,23 +0,0 @@ -```console -$ 03_01_flag_bool_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 03_01_flag_bool_derive[EXE] [OPTIONS] - -OPTIONS: - -h, --help Print help information - -v, --verbose - -V, --version Print version information - -$ 03_01_flag_bool_derive -verbose: false - -$ 03_01_flag_bool_derive --verbose -verbose: true - -$ 03_01_flag_bool_derive --verbose --verbose -verbose: true - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_bool.rs b/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_bool.rs deleted file mode 100644 index de677d8c6..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_bool.rs +++ /dev/null @@ -1,14 +0,0 @@ -use clap::Parser; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - #[clap(short, long, action)] - verbose: bool, -} - -fn main() { - let cli = Cli::parse(); - - println!("verbose: {:?}", cli.verbose); -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_count.md b/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_count.md deleted file mode 100644 index 3d5a53084..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_count.md +++ /dev/null @@ -1,23 +0,0 @@ -```console -$ 03_01_flag_count_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 03_01_flag_count_derive[EXE] [OPTIONS] - -OPTIONS: - -h, --help Print help information - -v, --verbose - -V, --version Print version information - -$ 03_01_flag_count_derive -verbose: 0 - -$ 03_01_flag_count_derive --verbose -verbose: 1 - -$ 03_01_flag_count_derive --verbose --verbose -verbose: 2 - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_count.rs b/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_count.rs deleted file mode 100644 index 680f7f5e5..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_01_flag_count.rs +++ /dev/null @@ -1,14 +0,0 @@ -use clap::Parser; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - #[clap(short, long, action = clap::ArgAction::Count)] - verbose: u8, -} - -fn main() { - let cli = Cli::parse(); - - println!("verbose: {:?}", cli.verbose); -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_02_option.md b/vendor/clap-3.2.20/examples/tutorial_derive/03_02_option.md deleted file mode 100644 index 84ff7fa74..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_02_option.md +++ /dev/null @@ -1,32 +0,0 @@ -```console -$ 03_02_option_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 03_02_option_derive[EXE] [OPTIONS] - -OPTIONS: - -h, --help Print help information - -n, --name - -V, --version Print version information - -$ 03_02_option_derive -name: None - -$ 03_02_option_derive --name bob -name: Some("bob") - -$ 03_02_option_derive --name=bob -name: Some("bob") - -$ 03_02_option_derive -n bob -name: Some("bob") - -$ 03_02_option_derive -n=bob -name: Some("bob") - -$ 03_02_option_derive -nbob -name: Some("bob") - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_02_option.rs b/vendor/clap-3.2.20/examples/tutorial_derive/03_02_option.rs deleted file mode 100644 index 75b67afe7..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_02_option.rs +++ /dev/null @@ -1,14 +0,0 @@ -use clap::Parser; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - #[clap(short, long, value_parser)] - name: Option, -} - -fn main() { - let cli = Cli::parse(); - - println!("name: {:?}", cli.name.as_deref()); -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_03_positional.md b/vendor/clap-3.2.20/examples/tutorial_derive/03_03_positional.md deleted file mode 100644 index 7281fe3ff..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_03_positional.md +++ /dev/null @@ -1,22 +0,0 @@ -```console -$ 03_03_positional_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 03_03_positional_derive[EXE] [NAME] - -ARGS: - - -OPTIONS: - -h, --help Print help information - -V, --version Print version information - -$ 03_03_positional_derive -name: None - -$ 03_03_positional_derive bob -name: Some("bob") - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_03_positional.rs b/vendor/clap-3.2.20/examples/tutorial_derive/03_03_positional.rs deleted file mode 100644 index 7478951f1..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_03_positional.rs +++ /dev/null @@ -1,14 +0,0 @@ -use clap::Parser; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - #[clap(value_parser)] - name: Option, -} - -fn main() { - let cli = Cli::parse(); - - println!("name: {:?}", cli.name.as_deref()); -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands.md b/vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands.md deleted file mode 100644 index 02f96e3d3..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands.md +++ /dev/null @@ -1,64 +0,0 @@ -```console -$ 03_04_subcommands_derive help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 03_04_subcommands_derive[EXE] - -OPTIONS: - -h, --help Print help information - -V, --version Print version information - -SUBCOMMANDS: - add Adds files to myapp - help Print this message or the help of the given subcommand(s) - -$ 03_04_subcommands_derive help add -03_04_subcommands_derive[EXE]-add [..] -Adds files to myapp - -USAGE: - 03_04_subcommands_derive[EXE] add [NAME] - -ARGS: - - -OPTIONS: - -h, --help Print help information - -V, --version Print version information - -$ 03_04_subcommands_derive add bob -'myapp add' was used, name is: Some("bob") - -``` - -Because we used `command: Commands` instead of `command: Option`: -```console -$ 03_04_subcommands_derive -? failed -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 03_04_subcommands_derive[EXE] - -OPTIONS: - -h, --help Print help information - -V, --version Print version information - -SUBCOMMANDS: - add Adds files to myapp - help Print this message or the help of the given subcommand(s) - -``` - -Because we added `#[clap(propagate_version = true)]`: -```console -$ 03_04_subcommands_derive --version -clap [..] - -$ 03_04_subcommands_derive add --version -03_04_subcommands_derive[EXE]-add [..] - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands.rs b/vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands.rs deleted file mode 100644 index 62a45a97e..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands.rs +++ /dev/null @@ -1,30 +0,0 @@ -use clap::{Parser, Subcommand}; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -#[clap(propagate_version = true)] -struct Cli { - #[clap(subcommand)] - command: Commands, -} - -#[derive(Subcommand)] -enum Commands { - /// Adds files to myapp - Add { - #[clap(value_parser)] - name: Option, - }, -} - -fn main() { - let cli = Cli::parse(); - - // You can check for the existence of subcommands, and if found use their - // matches just as you would the top level cmd - match &cli.command { - Commands::Add { name } => { - println!("'myapp add' was used, name is: {:?}", name) - } - } -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands_alt.rs b/vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands_alt.rs deleted file mode 100644 index b6124936c..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_04_subcommands_alt.rs +++ /dev/null @@ -1,33 +0,0 @@ -use clap::{Args, Parser, Subcommand}; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -#[clap(propagate_version = true)] -struct Cli { - #[clap(subcommand)] - command: Commands, -} - -#[derive(Subcommand)] -enum Commands { - /// Adds files to myapp - Add(Add), -} - -#[derive(Args)] -struct Add { - #[clap(value_parser)] - name: Option, -} - -fn main() { - let cli = Cli::parse(); - - // You can check for the existence of subcommands, and if found use their - // matches just as you would the top level cmd - match &cli.command { - Commands::Add(name) => { - println!("'myapp add' was used, name is: {:?}", name.name) - } - } -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_05_default_values.md b/vendor/clap-3.2.20/examples/tutorial_derive/03_05_default_values.md deleted file mode 100644 index f7315e736..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_05_default_values.md +++ /dev/null @@ -1,22 +0,0 @@ -```console -$ 03_05_default_values_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 03_05_default_values_derive[EXE] [NAME] - -ARGS: - [default: alice] - -OPTIONS: - -h, --help Print help information - -V, --version Print version information - -$ 03_05_default_values_derive -name: "alice" - -$ 03_05_default_values_derive bob -name: "bob" - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/03_05_default_values.rs b/vendor/clap-3.2.20/examples/tutorial_derive/03_05_default_values.rs deleted file mode 100644 index 10a1ec808..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/03_05_default_values.rs +++ /dev/null @@ -1,14 +0,0 @@ -use clap::Parser; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - #[clap(default_value_t = String::from("alice"), value_parser)] - name: String, -} - -fn main() { - let cli = Cli::parse(); - - println!("name: {:?}", cli.name); -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/04_01_enum.md b/vendor/clap-3.2.20/examples/tutorial_derive/04_01_enum.md deleted file mode 100644 index 2523af924..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/04_01_enum.md +++ /dev/null @@ -1,29 +0,0 @@ -```console -$ 04_01_enum_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 04_01_enum_derive[EXE] - -ARGS: - What mode to run the program in [possible values: fast, slow] - -OPTIONS: - -h, --help Print help information - -V, --version Print version information - -$ 04_01_enum_derive fast -Hare - -$ 04_01_enum_derive slow -Tortoise - -$ 04_01_enum_derive medium -? failed -error: "medium" isn't a valid value for '' - [possible values: fast, slow] - -For more information try --help - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/04_01_enum.rs b/vendor/clap-3.2.20/examples/tutorial_derive/04_01_enum.rs deleted file mode 100644 index 1ac984288..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/04_01_enum.rs +++ /dev/null @@ -1,28 +0,0 @@ -use clap::{Parser, ValueEnum}; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - /// What mode to run the program in - #[clap(arg_enum, value_parser)] - mode: Mode, -} - -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] -enum Mode { - Fast, - Slow, -} - -fn main() { - let cli = Cli::parse(); - - match cli.mode { - Mode::Fast => { - println!("Hare"); - } - Mode::Slow => { - println!("Tortoise"); - } - } -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/04_02_parse.md b/vendor/clap-3.2.20/examples/tutorial_derive/04_02_parse.md deleted file mode 100644 index 6079ef193..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/04_02_parse.md +++ /dev/null @@ -1,31 +0,0 @@ -```console -$ 04_02_parse_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 04_02_parse_derive[EXE] - -ARGS: - Network port to use - -OPTIONS: - -h, --help Print help information - -V, --version Print version information - -$ 04_02_parse_derive 22 -PORT = 22 - -$ 04_02_parse_derive foobar -? failed -error: Invalid value "foobar" for '': invalid digit found in string - -For more information try --help - -$ 04_02_parse_derive 0 -? failed -error: Invalid value "0" for '': 0 is not in 1..=65535 - -For more information try --help - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/04_02_parse.rs b/vendor/clap-3.2.20/examples/tutorial_derive/04_02_parse.rs deleted file mode 100644 index 6336a9cf1..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/04_02_parse.rs +++ /dev/null @@ -1,15 +0,0 @@ -use clap::Parser; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - /// Network port to use - #[clap(value_parser = clap::value_parser!(u16).range(1..))] - port: u16, -} - -fn main() { - let cli = Cli::parse(); - - println!("PORT = {}", cli.port); -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/04_02_validate.md b/vendor/clap-3.2.20/examples/tutorial_derive/04_02_validate.md deleted file mode 100644 index cc43440ef..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/04_02_validate.md +++ /dev/null @@ -1,31 +0,0 @@ -```console -$ 04_02_validate_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 04_02_validate_derive[EXE] - -ARGS: - Network port to use - -OPTIONS: - -h, --help Print help information - -V, --version Print version information - -$ 04_02_validate_derive 22 -PORT = 22 - -$ 04_02_validate_derive foobar -? failed -error: Invalid value "foobar" for '': `foobar` isn't a port number - -For more information try --help - -$ 04_02_validate_derive 0 -? failed -error: Invalid value "0" for '': Port not in range 1-65535 - -For more information try --help - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/04_02_validate.rs b/vendor/clap-3.2.20/examples/tutorial_derive/04_02_validate.rs deleted file mode 100644 index 7dac79c9f..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/04_02_validate.rs +++ /dev/null @@ -1,34 +0,0 @@ -use std::ops::RangeInclusive; - -use clap::Parser; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - /// Network port to use - #[clap(value_parser = port_in_range)] - port: u16, -} - -fn main() { - let cli = Cli::parse(); - - println!("PORT = {}", cli.port); -} - -const PORT_RANGE: RangeInclusive = 1..=65535; - -fn port_in_range(s: &str) -> Result { - let port: usize = s - .parse() - .map_err(|_| format!("`{}` isn't a port number", s))?; - if PORT_RANGE.contains(&port) { - Ok(port as u16) - } else { - Err(format!( - "Port not in range {}-{}", - PORT_RANGE.start(), - PORT_RANGE.end() - )) - } -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/04_03_relations.md b/vendor/clap-3.2.20/examples/tutorial_derive/04_03_relations.md deleted file mode 100644 index 4f5703d82..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/04_03_relations.md +++ /dev/null @@ -1,58 +0,0 @@ -```console -$ 04_03_relations_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 04_03_relations_derive[EXE] [OPTIONS] <--set-ver |--major|--minor|--patch> [INPUT_FILE] - -ARGS: - some regular input - -OPTIONS: - -c - -h, --help Print help information - --major auto inc major - --minor auto inc minor - --patch auto inc patch - --set-ver set version manually - --spec-in some special input argument - -V, --version Print version information - -$ 04_03_relations_derive -? failed -error: The following required arguments were not provided: - <--set-ver |--major|--minor|--patch> - -USAGE: - 04_03_relations_derive[EXE] [OPTIONS] <--set-ver |--major|--minor|--patch> [INPUT_FILE] - -For more information try --help - -$ 04_03_relations_derive --major -Version: 2.2.3 - -$ 04_03_relations_derive --major --minor -? failed -error: The argument '--major' cannot be used with '--minor' - -USAGE: - 04_03_relations_derive[EXE] <--set-ver |--major|--minor|--patch> - -For more information try --help - -$ 04_03_relations_derive --major -c config.toml -? failed -error: The following required arguments were not provided: - > - -USAGE: - 04_03_relations_derive[EXE] -c <--set-ver |--major|--minor|--patch> > - -For more information try --help - -$ 04_03_relations_derive --major -c config.toml --spec-in input.txt -Version: 2.2.3 -Doing work using input input.txt and config config.toml - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/04_03_relations.rs b/vendor/clap-3.2.20/examples/tutorial_derive/04_03_relations.rs deleted file mode 100644 index 37efe95e3..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/04_03_relations.rs +++ /dev/null @@ -1,72 +0,0 @@ -use clap::{ArgGroup, Parser}; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -#[clap(group( - ArgGroup::new("vers") - .required(true) - .args(&["set-ver", "major", "minor", "patch"]), - ))] -struct Cli { - /// set version manually - #[clap(long, value_name = "VER", value_parser)] - set_ver: Option, - - /// auto inc major - #[clap(long, action)] - major: bool, - - /// auto inc minor - #[clap(long, action)] - minor: bool, - - /// auto inc patch - #[clap(long, action)] - patch: bool, - - /// some regular input - #[clap(group = "input", value_parser)] - input_file: Option, - - /// some special input argument - #[clap(long, group = "input", value_parser)] - spec_in: Option, - - #[clap(short, requires = "input", value_parser)] - config: Option, -} - -fn main() { - let cli = Cli::parse(); - - // Let's assume the old version 1.2.3 - let mut major = 1; - let mut minor = 2; - let mut patch = 3; - - // See if --set_ver was used to set the version manually - let version = if let Some(ver) = cli.set_ver.as_deref() { - ver.to_string() - } else { - // Increment the one requested (in a real program, we'd reset the lower numbers) - let (maj, min, pat) = (cli.major, cli.minor, cli.patch); - match (maj, min, pat) { - (true, _, _) => major += 1, - (_, true, _) => minor += 1, - (_, _, true) => patch += 1, - _ => unreachable!(), - }; - format!("{}.{}.{}", major, minor, patch) - }; - - println!("Version: {}", version); - - // Check for usage of -c - if let Some(config) = cli.config.as_deref() { - let input = cli - .input_file - .as_deref() - .unwrap_or_else(|| cli.spec_in.as_deref().unwrap()); - println!("Doing work using input {} and config {}", input, config); - } -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/04_04_custom.md b/vendor/clap-3.2.20/examples/tutorial_derive/04_04_custom.md deleted file mode 100644 index 0f19bfe31..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/04_04_custom.md +++ /dev/null @@ -1,57 +0,0 @@ -```console -$ 04_04_custom_derive --help -clap [..] -A simple to use, efficient, and full-featured Command Line Argument Parser - -USAGE: - 04_04_custom_derive[EXE] [OPTIONS] [INPUT_FILE] - -ARGS: - some regular input - -OPTIONS: - -c - -h, --help Print help information - --major auto inc major - --minor auto inc minor - --patch auto inc patch - --set-ver set version manually - --spec-in some special input argument - -V, --version Print version information - -$ 04_04_custom_derive -? failed -error: Can only modify one version field - -USAGE: - clap [OPTIONS] [INPUT_FILE] - -For more information try --help - -$ 04_04_custom_derive --major -Version: 2.2.3 - -$ 04_04_custom_derive --major --minor -? failed -error: Can only modify one version field - -USAGE: - clap [OPTIONS] [INPUT_FILE] - -For more information try --help - -$ 04_04_custom_derive --major -c config.toml -? failed -Version: 2.2.3 -error: INPUT_FILE or --spec-in is required when using --config - -USAGE: - clap [OPTIONS] [INPUT_FILE] - -For more information try --help - -$ 04_04_custom_derive --major -c config.toml --spec-in input.txt -Version: 2.2.3 -Doing work using input input.txt and config config.toml - -``` diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/04_04_custom.rs b/vendor/clap-3.2.20/examples/tutorial_derive/04_04_custom.rs deleted file mode 100644 index 454d489c1..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/04_04_custom.rs +++ /dev/null @@ -1,93 +0,0 @@ -use clap::{CommandFactory, ErrorKind, Parser}; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - /// set version manually - #[clap(long, value_name = "VER", value_parser)] - set_ver: Option, - - /// auto inc major - #[clap(long, action)] - major: bool, - - /// auto inc minor - #[clap(long, action)] - minor: bool, - - /// auto inc patch - #[clap(long, action)] - patch: bool, - - /// some regular input - #[clap(value_parser)] - input_file: Option, - - /// some special input argument - #[clap(long, value_parser)] - spec_in: Option, - - #[clap(short, value_parser)] - config: Option, -} - -fn main() { - let cli = Cli::parse(); - - // Let's assume the old version 1.2.3 - let mut major = 1; - let mut minor = 2; - let mut patch = 3; - - // See if --set-ver was used to set the version manually - let version = if let Some(ver) = cli.set_ver.as_deref() { - if cli.major || cli.minor || cli.patch { - let mut cmd = Cli::command(); - cmd.error( - ErrorKind::ArgumentConflict, - "Can't do relative and absolute version change", - ) - .exit(); - } - ver.to_string() - } else { - // Increment the one requested (in a real program, we'd reset the lower numbers) - let (maj, min, pat) = (cli.major, cli.minor, cli.patch); - match (maj, min, pat) { - (true, false, false) => major += 1, - (false, true, false) => minor += 1, - (false, false, true) => patch += 1, - _ => { - let mut cmd = Cli::command(); - cmd.error( - ErrorKind::ArgumentConflict, - "Can only modify one version field", - ) - .exit(); - } - }; - format!("{}.{}.{}", major, minor, patch) - }; - - println!("Version: {}", version); - - // Check for usage of -c - if let Some(config) = cli.config.as_deref() { - // todo: remove `#[allow(clippy::or_fun_call)]` lint when MSRV is bumped. - #[allow(clippy::or_fun_call)] - let input = cli - .input_file - .as_deref() - // 'or' is preferred to 'or_else' here since `Option::as_deref` is 'const' - .or(cli.spec_in.as_deref()) - .unwrap_or_else(|| { - let mut cmd = Cli::command(); - cmd.error( - ErrorKind::MissingRequiredArgument, - "INPUT_FILE or --spec-in is required when using --config", - ) - .exit() - }); - println!("Doing work using input {} and config {}", input, config); - } -} diff --git a/vendor/clap-3.2.20/examples/tutorial_derive/05_01_assert.rs b/vendor/clap-3.2.20/examples/tutorial_derive/05_01_assert.rs deleted file mode 100644 index 66dca727f..000000000 --- a/vendor/clap-3.2.20/examples/tutorial_derive/05_01_assert.rs +++ /dev/null @@ -1,21 +0,0 @@ -use clap::Parser; - -#[derive(Parser)] -#[clap(author, version, about, long_about = None)] -struct Cli { - /// Network port to use - #[clap(value_parser)] - port: u16, -} - -fn main() { - let cli = Cli::parse(); - - println!("PORT = {}", cli.port); -} - -#[test] -fn verify_cli() { - use clap::CommandFactory; - Cli::command().debug_assert() -} -- cgit v1.2.3