mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
assert on leading and trailing whitespace
This commit is contained in:
parent
5580e8c465
commit
1d3a292d6b
22 changed files with 307 additions and 158 deletions
|
@ -9,7 +9,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static DONT_COLLAPSE_ARGS: &str = "clap-test v1.4.8
|
||||
|
||||
|
@ -23,7 +24,8 @@ ARGS:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static REQUIRE_EQUALS: &str = "clap-test v1.4.8
|
||||
|
||||
|
@ -35,7 +37,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-o, --opt=<FILE> some";
|
||||
-o, --opt=<FILE> some
|
||||
";
|
||||
|
||||
static UNIFIED_HELP: &str = "test 1.3
|
||||
|
||||
|
@ -53,7 +56,8 @@ OPTIONS:
|
|||
-f, --flag some flag
|
||||
-h, --help Print help information
|
||||
--option <opt> some option
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static SKIP_POS_VALS: &str = "test 1.3
|
||||
|
||||
|
@ -72,7 +76,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-o, --opt <opt> some option";
|
||||
-o, --opt <opt> some option
|
||||
";
|
||||
|
||||
static ARG_REQUIRED_ELSE_HELP: &str = "test 1.0
|
||||
|
||||
|
@ -82,7 +87,8 @@ USAGE:
|
|||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-i, --info Provides more info
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static SUBCOMMAND_REQUIRED_ELSE_HELP: &str = "test 1.0
|
||||
|
||||
|
@ -95,7 +101,8 @@ FLAGS:
|
|||
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
info";
|
||||
info
|
||||
";
|
||||
|
||||
static LONG_FORMAT_FOR_HELP_SUBCOMMAND: &str = "myprog-test
|
||||
|
||||
|
@ -111,7 +118,8 @@ FLAGS:
|
|||
Print help information
|
||||
|
||||
-V, --version
|
||||
Print version information";
|
||||
Print version information
|
||||
";
|
||||
|
||||
static LONG_FORMAT_FOR_NESTED_HELP_SUBCOMMAND: &str = "myprog-test-nested
|
||||
|
||||
|
@ -125,7 +133,8 @@ FLAGS:
|
|||
Print help information
|
||||
|
||||
-V, --version
|
||||
Print version information";
|
||||
Print version information
|
||||
";
|
||||
|
||||
static LONG_FORMAT_SINGLE_ARG_HELP_SUBCOMMAND: &str = "myprog
|
||||
|
||||
|
@ -146,7 +155,9 @@ FLAGS:
|
|||
SUBCOMMANDS:
|
||||
help
|
||||
Print this message or the help of the given subcommand(s)
|
||||
test";
|
||||
test
|
||||
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn sub_command_negate_required() {
|
||||
|
|
|
@ -15,7 +15,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-o, --opt <opt> [aliases: visible]";
|
||||
-o, --opt <opt> [aliases: visible]
|
||||
";
|
||||
|
||||
static SC_INVISIBLE_ALIAS_HELP: &str = "ct-test 1.2
|
||||
|
||||
|
@ -30,7 +31,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-o, --opt <opt> ";
|
||||
-o, --opt <opt>
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn single_alias_of_option() {
|
||||
|
|
|
@ -15,7 +15,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-o, --opt <opt> [short aliases: v]";
|
||||
-o, --opt <opt> [short aliases: v]
|
||||
";
|
||||
|
||||
static SC_INVISIBLE_ALIAS_HELP: &str = "ct-test 1.2
|
||||
|
||||
|
@ -30,7 +31,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-o, --opt <opt> ";
|
||||
-o, --opt <opt>
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn single_short_alias_of_option() {
|
||||
|
|
|
@ -7,21 +7,24 @@ static CONFLICT_ERR: &str = "error: The argument '-F' cannot be used with '--fla
|
|||
USAGE:
|
||||
clap-test --flag --long-option-2 <option2> <positional> <positional2>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
static CONFLICT_ERR_REV: &str = "error: The argument '--flag' cannot be used with '-F'
|
||||
|
||||
USAGE:
|
||||
clap-test -F --long-option-2 <option2> <positional> <positional2>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
static CONFLICT_ERR_THREE: &str = "error: The argument '--two' cannot be used with '--one'
|
||||
|
||||
USAGE:
|
||||
three_conflicting_arguments --one
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn flag_conflict() {
|
||||
|
|
|
@ -608,7 +608,8 @@ fn default_vals_donnot_show_in_smart_usage() {
|
|||
USAGE:
|
||||
bug [OPTIONS] <input>
|
||||
|
||||
For more information try --help",
|
||||
For more information try --help
|
||||
",
|
||||
true,
|
||||
));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
--option_a <option_a> second option
|
||||
--option_b <option_b> first option";
|
||||
--option_b <option_b> first option
|
||||
";
|
||||
|
||||
static DERIVE_ORDER: &str = "test 1.2
|
||||
|
||||
|
@ -32,7 +33,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
--option_b <option_b> first option
|
||||
--option_a <option_a> second option";
|
||||
--option_a <option_a> second option
|
||||
";
|
||||
|
||||
static UNIFIED_HELP: &str = "test 1.2
|
||||
|
||||
|
@ -45,7 +47,8 @@ OPTIONS:
|
|||
-h, --help Print help information
|
||||
--option_a <option_a> second option
|
||||
--option_b <option_b> first option
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static UNIFIED_HELP_AND_DERIVE: &str = "test 1.2
|
||||
|
||||
|
@ -58,7 +61,8 @@ OPTIONS:
|
|||
--flag_b first flag
|
||||
--option_b <option_b> first option
|
||||
--flag_a second flag
|
||||
--option_a <option_a> second option";
|
||||
--option_a <option_a> second option
|
||||
";
|
||||
|
||||
static DERIVE_ORDER_SC_PROP: &str = "test-sub 1.2
|
||||
|
||||
|
@ -73,7 +77,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
--option_b <option_b> first option
|
||||
--option_a <option_a> second option";
|
||||
--option_a <option_a> second option
|
||||
";
|
||||
|
||||
static UNIFIED_SC_PROP: &str = "test-sub 1.2
|
||||
|
||||
|
@ -86,7 +91,8 @@ OPTIONS:
|
|||
-h, --help Print help information
|
||||
--option_a <option_a> second option
|
||||
--option_b <option_b> first option
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static UNIFIED_DERIVE_SC_PROP: &str = "test-sub 1.2
|
||||
|
||||
|
@ -99,7 +105,8 @@ OPTIONS:
|
|||
--flag_a second flag
|
||||
--option_a <option_a> second option
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static UNIFIED_DERIVE_SC_PROP_EXPLICIT_ORDER: &str = "test-sub 1.2
|
||||
|
||||
|
@ -112,7 +119,8 @@ OPTIONS:
|
|||
--option_b <option_b> first option
|
||||
--option_a <option_a> second option
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static PREFER_USER_HELP_DERIVE_ORDER: &str = "test 1.2
|
||||
|
||||
|
@ -123,7 +131,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
-h, --help Print help message
|
||||
--flag_b first flag
|
||||
--flag_a second flag";
|
||||
--flag_a second flag
|
||||
";
|
||||
|
||||
static PREFER_USER_HELP_SUBCMD_DERIVE_ORDER: &str = "test-sub 1.2
|
||||
|
||||
|
@ -134,7 +143,8 @@ FLAGS:
|
|||
-h, --help Print help message
|
||||
--flag_b first flag
|
||||
--flag_a second flag
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn no_derive_order() {
|
||||
|
|
|
@ -20,7 +20,8 @@ FLAGS:
|
|||
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
sub",
|
||||
sub
|
||||
",
|
||||
false
|
||||
));
|
||||
}
|
||||
|
|
|
@ -118,7 +118,8 @@ fn no_empty_values_without_equals_but_requires_equals() {
|
|||
USAGE:
|
||||
config [OPTIONS]
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
assert!(utils::compare_output(
|
||||
app,
|
||||
|
|
|
@ -436,7 +436,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
-i, --info <info>... view package information
|
||||
-s, --search <search>... search locally installed packages for matching strings";
|
||||
-s, --search <search>... search locally installed packages for matching strings
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn flag_subcommand_long_short_normal_usage_string() {
|
||||
|
@ -493,7 +494,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
-i, --info <info>... view package information
|
||||
-s, --search <search>... search locally installed packages for matching strings";
|
||||
-s, --search <search>... search locally installed packages for matching strings
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn flag_subcommand_long_normal_usage_string() {
|
||||
|
@ -549,7 +551,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
-i, --info <info>... view package information
|
||||
-s, --search <search>... search locally installed packages for matching strings";
|
||||
-s, --search <search>... search locally installed packages for matching strings
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn flag_subcommand_short_normal_usage_string() {
|
||||
|
|
|
@ -9,7 +9,8 @@ const USE_FLAG_AS_ARGUMENT: &str =
|
|||
USAGE:
|
||||
mycat [FLAGS] [filename]
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn flag_using_short() {
|
||||
|
@ -168,7 +169,8 @@ fn issue_2308_multiple_dashes() {
|
|||
USAGE:
|
||||
test <arg>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
let app = App::new("test").arg(Arg::new("arg").takes_value(true).required(true));
|
||||
|
||||
assert!(utils::compare_output(
|
||||
|
|
|
@ -8,7 +8,8 @@ static REQ_GROUP_USAGE: &str = "error: The following required arguments were not
|
|||
USAGE:
|
||||
clap-test <base|--delete>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
static REQ_GROUP_CONFLICT_USAGE: &str =
|
||||
"error: The argument '--delete' cannot be used with '<base>'
|
||||
|
@ -16,7 +17,8 @@ static REQ_GROUP_CONFLICT_USAGE: &str =
|
|||
USAGE:
|
||||
clap-test <base|--delete>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
static REQ_GROUP_CONFLICT_ONLY_OPTIONS: &str =
|
||||
"error: The argument '--delete' cannot be used with '--all'
|
||||
|
@ -24,7 +26,8 @@ static REQ_GROUP_CONFLICT_ONLY_OPTIONS: &str =
|
|||
USAGE:
|
||||
clap-test <--all|--delete>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn required_group_missing_arg() {
|
||||
|
@ -264,7 +267,8 @@ ARGS:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
let app = App::new("prog")
|
||||
.arg(Arg::new("a").value_name("A"))
|
||||
.group(ArgGroup::new("group").arg("a").required(true));
|
||||
|
|
179
tests/help.rs
179
tests/help.rs
|
@ -16,7 +16,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-f, --fake <some>:<val> some help";
|
||||
-f, --fake <some>:<val> some help
|
||||
";
|
||||
|
||||
static HELP: &str = "clap-test v1.4.8
|
||||
|
||||
|
@ -49,7 +50,8 @@ OPTIONS:
|
|||
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
subcmd tests subcommands";
|
||||
subcmd tests subcommands
|
||||
";
|
||||
|
||||
static SC_NEGATES_REQS: &str = "prog 1.0
|
||||
|
||||
|
@ -69,7 +71,8 @@ OPTIONS:
|
|||
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
test";
|
||||
test
|
||||
";
|
||||
|
||||
static ARGS_NEGATE_SC: &str = "prog 1.0
|
||||
|
||||
|
@ -90,7 +93,8 @@ OPTIONS:
|
|||
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
test";
|
||||
test
|
||||
";
|
||||
|
||||
static AFTER_HELP: &str = "some text that comes before the help
|
||||
|
||||
|
@ -105,7 +109,8 @@ FLAGS:
|
|||
-h, --help Print help information
|
||||
-V, --version Print version information
|
||||
|
||||
some text that comes after the help";
|
||||
some text that comes after the help
|
||||
";
|
||||
|
||||
static AFTER_LONG_HELP: &str = "some longer text that comes before the help
|
||||
|
||||
|
@ -123,7 +128,8 @@ FLAGS:
|
|||
-V, --version
|
||||
Print version information
|
||||
|
||||
some longer text that comes after the help";
|
||||
some longer text that comes after the help
|
||||
";
|
||||
|
||||
static HIDDEN_ARGS: &str = "prog 1.0
|
||||
|
||||
|
@ -136,7 +142,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-o, --opt <FILE> tests options";
|
||||
-o, --opt <FILE> tests options
|
||||
";
|
||||
|
||||
static SC_HELP: &str = "clap-test-subcmd 0.1
|
||||
|
||||
|
@ -157,7 +164,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
-o, --option <scoption>... tests options
|
||||
-s, --subcmdarg <subcmdarg> tests other args";
|
||||
-s, --subcmdarg <subcmdarg> tests other args
|
||||
";
|
||||
|
||||
static ISSUE_1046_HIDDEN_SCS: &str = "prog 1.0
|
||||
|
||||
|
@ -173,7 +181,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-o, --opt <FILE> tests options";
|
||||
-o, --opt <FILE> tests options
|
||||
";
|
||||
|
||||
// Using number_of_values(1) with multiple_values(true) misaligns help message
|
||||
static ISSUE_760: &str = "ctest 0.1
|
||||
|
@ -187,7 +196,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
-o, --option <option> tests options
|
||||
-O, --opt <opt> tests options";
|
||||
-O, --opt <opt> tests options
|
||||
";
|
||||
|
||||
static RIPGREP_USAGE: &str = "ripgrep 0.5
|
||||
|
||||
|
@ -199,7 +209,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static MULTI_SC_HELP: &str = "ctest-subcmd-multi 0.1
|
||||
|
||||
|
@ -216,7 +227,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-o, --option <scoption>... tests options";
|
||||
-o, --option <scoption>... tests options
|
||||
";
|
||||
|
||||
static ISSUE_626_CUTOFF: &str = "ctest 0.1
|
||||
|
||||
|
@ -235,7 +247,8 @@ OPTIONS:
|
|||
hot beverages. Some coffeehouses also serve
|
||||
cold beverages such as iced coffee and iced
|
||||
tea. Many cafés also serve some type of food,
|
||||
such as light snacks, muffins, or pastries.";
|
||||
such as light snacks, muffins, or pastries.
|
||||
";
|
||||
|
||||
static ISSUE_626_PANIC: &str = "ctest 0.1
|
||||
|
||||
|
@ -254,7 +267,8 @@ OPTIONS:
|
|||
des plantations qui sont cultivées pour
|
||||
les marchés d\'exportation. Le café est
|
||||
souvent une contribution majeure aux
|
||||
exportations des régions productrices.";
|
||||
exportations des régions productrices.
|
||||
";
|
||||
|
||||
static HIDE_POS_VALS: &str = "ctest 0.1
|
||||
|
||||
|
@ -267,7 +281,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café.
|
||||
-p, --pos <VAL> Some vals [possible values: fast, slow]";
|
||||
-p, --pos <VAL> Some vals [possible values: fast, slow]
|
||||
";
|
||||
|
||||
static FINAL_WORD_WRAPPING: &str = "ctest 0.1
|
||||
|
||||
|
@ -282,7 +297,8 @@ FLAGS:
|
|||
-V, --version
|
||||
Print
|
||||
version
|
||||
information";
|
||||
information
|
||||
";
|
||||
|
||||
static OLD_NEWLINE_CHARS: &str = "ctest 0.1
|
||||
|
||||
|
@ -293,7 +309,8 @@ FLAGS:
|
|||
-h, --help Print help information
|
||||
-m Some help with some wrapping
|
||||
(Defaults to something)
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static WRAPPING_NEWLINE_CHARS: &str = "ctest 0.1
|
||||
|
||||
|
@ -310,7 +327,8 @@ ARGS:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static ISSUE_688: &str = "ctest 0.1
|
||||
|
||||
|
@ -324,7 +342,8 @@ FLAGS:
|
|||
OPTIONS:
|
||||
--filter <filter> Sets the filter, or sampling method, to use for interpolation when resizing the particle
|
||||
images. The default is Linear (Bilinear). [possible values: Nearest, Linear, Cubic,
|
||||
Gaussian, Lanczos3]";
|
||||
Gaussian, Lanczos3]
|
||||
";
|
||||
|
||||
static ISSUE_702: &str = "myapp 1.0
|
||||
|
||||
|
@ -346,7 +365,8 @@ FLAGS:
|
|||
OPTIONS:
|
||||
-l, --label <label>... a label
|
||||
-o, --other <other> some other option
|
||||
-s, --some <some> some option";
|
||||
-s, --some <some> some option
|
||||
";
|
||||
|
||||
static ISSUE_777: &str = "A app with a crazy very long long
|
||||
long name hahaha 1.0
|
||||
|
@ -366,7 +386,8 @@ FLAGS:
|
|||
|
||||
-V, --version
|
||||
Print version
|
||||
information";
|
||||
information
|
||||
";
|
||||
|
||||
static ISSUE_1642: &str = "prog
|
||||
|
||||
|
@ -384,7 +405,8 @@ FLAGS:
|
|||
Print help information
|
||||
|
||||
-V, --version
|
||||
Print version information";
|
||||
Print version information
|
||||
";
|
||||
|
||||
static HELP_CONFLICT: &str = "conflict
|
||||
|
||||
|
@ -394,7 +416,8 @@ USAGE:
|
|||
FLAGS:
|
||||
-h
|
||||
--help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static LAST_ARG: &str = "last 0.1
|
||||
|
||||
|
@ -408,7 +431,8 @@ ARGS:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static LAST_ARG_SC: &str = "last 0.1
|
||||
|
||||
|
@ -427,7 +451,8 @@ FLAGS:
|
|||
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
test some";
|
||||
test some
|
||||
";
|
||||
|
||||
static LAST_ARG_REQ: &str = "last 0.1
|
||||
|
||||
|
@ -441,7 +466,8 @@ ARGS:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static LAST_ARG_REQ_SC: &str = "last 0.1
|
||||
|
||||
|
@ -460,7 +486,8 @@ FLAGS:
|
|||
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
test some";
|
||||
test some
|
||||
";
|
||||
|
||||
static HIDE_DEFAULT_VAL: &str = "default 0.1
|
||||
|
||||
|
@ -472,7 +499,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
--arg <argument> Pass an argument to the program. [default: default-argument]";
|
||||
--arg <argument> Pass an argument to the program. [default: default-argument]
|
||||
";
|
||||
|
||||
static ESCAPED_DEFAULT_VAL: &str = "default 0.1
|
||||
|
||||
|
@ -485,7 +513,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
--arg <argument> Pass an argument to the program. [default: \"\\n\"] [possible values: normal, \" \", \"\\n\", \"\\t\",
|
||||
other]";
|
||||
other]
|
||||
";
|
||||
|
||||
static LAST_ARG_USAGE: &str = "flamegraph 0.1
|
||||
|
||||
|
@ -503,7 +532,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
-f, --frequency <HERTZ> The sampling frequency.
|
||||
-t, --timeout <SECONDS> Timeout in seconds.";
|
||||
-t, --timeout <SECONDS> Timeout in seconds.
|
||||
";
|
||||
|
||||
static LAST_ARG_REQ_MULT: &str = "example 1.0
|
||||
|
||||
|
@ -516,7 +546,8 @@ ARGS:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static DEFAULT_HELP: &str = "ctest 1.0
|
||||
|
||||
|
@ -525,7 +556,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static LONG_ABOUT: &str = "myapp 1.0
|
||||
|
||||
|
@ -547,7 +579,8 @@ FLAGS:
|
|||
Print help information
|
||||
|
||||
-V, --version
|
||||
Print version information";
|
||||
Print version information
|
||||
";
|
||||
|
||||
static CUSTOM_HELP_SECTION: &str = "blorp 1.4
|
||||
|
||||
|
@ -566,7 +599,8 @@ OPTIONS:
|
|||
-f, --fake <some>:<val> some help
|
||||
|
||||
NETWORKING:
|
||||
-n, --no-proxy Do not use system proxy settings";
|
||||
-n, --no-proxy Do not use system proxy settings
|
||||
";
|
||||
|
||||
static ISSUE_1487: &str = "test
|
||||
|
||||
|
@ -579,7 +613,8 @@ ARGS:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static ISSUE_1364: &str = "demo
|
||||
|
||||
|
@ -592,7 +627,8 @@ ARGS:
|
|||
FLAGS:
|
||||
-f
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static OPTION_USAGE_ORDER: &str = "order
|
||||
|
||||
|
@ -608,7 +644,8 @@ FLAGS:
|
|||
--select_file
|
||||
--select_folder
|
||||
-V, --version Print version information
|
||||
-x";
|
||||
-x
|
||||
";
|
||||
|
||||
static ABOUT_IN_SUBCOMMANDS_LIST: &str = "about-in-subcommands-list
|
||||
|
||||
|
@ -841,7 +878,7 @@ fn no_wrap_help() {
|
|||
assert!(utils::compare_output(
|
||||
app,
|
||||
"ctest --help",
|
||||
MULTI_SC_HELP,
|
||||
&format!("{}\n", MULTI_SC_HELP),
|
||||
false
|
||||
));
|
||||
}
|
||||
|
@ -884,7 +921,8 @@ FLAGS:
|
|||
Do not push generated commit and tags to git remote
|
||||
|
||||
-V, --version
|
||||
Print version information";
|
||||
Print version information
|
||||
";
|
||||
let app = App::new("test")
|
||||
.term_width(67)
|
||||
.arg(
|
||||
|
@ -933,7 +971,8 @@ FLAGS:
|
|||
--no-git-commit Do not commit version changes
|
||||
--no-git-push Do not push generated commit and tags to
|
||||
git remote
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
let app = App::new("test")
|
||||
.term_width(68)
|
||||
.arg(
|
||||
|
@ -1300,7 +1339,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-p, --package <name> ",
|
||||
-p, --package <name>
|
||||
",
|
||||
false
|
||||
));
|
||||
}
|
||||
|
@ -1432,7 +1472,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-H, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn override_help_short() {
|
||||
|
@ -1461,7 +1502,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --hell Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn override_help_long() {
|
||||
|
@ -1490,7 +1532,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn override_help_about() {
|
||||
|
@ -1789,7 +1832,8 @@ NETWORKING:
|
|||
|
||||
SPECIAL:
|
||||
-b, --birthday-song <song> Change which song is played for birthdays
|
||||
-v, --birthday-song-volume <volume> Change the volume of the birthday song";
|
||||
-v, --birthday-song-volume <volume> Change the volume of the birthday song
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn multiple_custom_help_headers() {
|
||||
|
@ -1863,7 +1907,8 @@ FLAGS:
|
|||
|
||||
SPECIAL:
|
||||
-b, --song <song> Change which song is played for birthdays
|
||||
-v, --song-volume <volume> Change the volume of the birthday song";
|
||||
-v, --song-volume <volume> Change the volume of the birthday song
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn custom_help_headers_hidden_args() {
|
||||
|
@ -1918,7 +1963,8 @@ FLAGS:
|
|||
Print help information
|
||||
|
||||
-V, --version
|
||||
Print version information";
|
||||
Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn show_long_about_issue_897() {
|
||||
|
@ -1945,7 +1991,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn show_short_about_issue_897() {
|
||||
|
@ -2127,7 +2174,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print custom help about text
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static HELP_ABOUT_MULTI_SC_OVERRIDE: &str = "myapp-subcmd-multi 1.0
|
||||
|
||||
|
@ -2136,7 +2184,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print custom help about text from multi
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn help_about_multi_subcmd() {
|
||||
|
@ -2247,7 +2296,8 @@ ARGS:
|
|||
FLAGS:
|
||||
-h, --help Print help information
|
||||
--option1
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
let app = clap::App::new("hello")
|
||||
.bin_name("deno")
|
||||
|
@ -2277,7 +2327,8 @@ OPTIONS:
|
|||
--speed <speed> How fast
|
||||
|
||||
NETWORKING:
|
||||
--flag Some flag";
|
||||
--flag Some flag
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn only_custom_heading_flags() {
|
||||
|
@ -2311,7 +2362,8 @@ FLAGS:
|
|||
-h, --help Print help information
|
||||
|
||||
NETWORKING:
|
||||
-s, --speed <SPEED> How fast";
|
||||
-s, --speed <SPEED> How fast
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn only_custom_heading_opts() {
|
||||
|
@ -2341,7 +2393,8 @@ FLAGS:
|
|||
-h, --help Print help information
|
||||
|
||||
NETWORKING:
|
||||
<speed> How fast";
|
||||
<speed> How fast
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn custom_heading_pos() {
|
||||
|
@ -2369,7 +2422,8 @@ FLAGS:
|
|||
-h, --help Print help information
|
||||
|
||||
NETWORKING:
|
||||
<speed> How fast";
|
||||
<speed> How fast
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn only_custom_heading_pos() {
|
||||
|
@ -2393,7 +2447,8 @@ USAGE:
|
|||
test
|
||||
|
||||
NETWORKING:
|
||||
--flag Some flag";
|
||||
--flag Some flag
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn only_custom_heading_flags_no_args() {
|
||||
|
@ -2418,7 +2473,8 @@ USAGE:
|
|||
test
|
||||
|
||||
NETWORKING:
|
||||
-s, --speed <SPEED> How fast";
|
||||
-s, --speed <SPEED> How fast
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn only_custom_heading_opts_no_args() {
|
||||
|
@ -2443,7 +2499,8 @@ USAGE:
|
|||
test [speed]
|
||||
|
||||
NETWORKING:
|
||||
<speed> How fast";
|
||||
<speed> How fast
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn only_custom_heading_pos_no_args() {
|
||||
|
@ -2486,7 +2543,8 @@ FLAGS:
|
|||
|
||||
OPTIONS:
|
||||
--some_arg <some_arg> <some_arg>
|
||||
--some_arg_issue <ARG> <ARG> ",
|
||||
--some_arg_issue <ARG> <ARG>
|
||||
",
|
||||
false
|
||||
));
|
||||
}
|
||||
|
@ -2576,8 +2634,7 @@ fn disabled_help_flag_and_subcommand() {
|
|||
"error: Found argument 'help' which wasn't expected, or isn't valid in this context
|
||||
|
||||
USAGE:
|
||||
foo [SUBCOMMAND]
|
||||
",
|
||||
foo [SUBCOMMAND]",
|
||||
true
|
||||
));
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café.";
|
||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café.
|
||||
";
|
||||
|
||||
static SHOW_ENV: &str = "ctest 0.1
|
||||
|
||||
|
@ -28,7 +29,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]";
|
||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
|
||||
";
|
||||
|
||||
static HIDE_ENV_VALS: &str = "ctest 0.1
|
||||
|
||||
|
@ -40,7 +42,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR]";
|
||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR]
|
||||
";
|
||||
|
||||
static SHOW_ENV_VALS: &str = "ctest 0.1
|
||||
|
||||
|
@ -52,7 +55,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]";
|
||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
|
||||
";
|
||||
|
||||
static HIDE_ENV_FLAG: &str = "ctest 0.1
|
||||
|
||||
|
@ -62,7 +66,8 @@ USAGE:
|
|||
FLAGS:
|
||||
-c, --cafe A coffeehouse, coffee shop, or café.
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static SHOW_ENV_FLAG: &str = "ctest 0.1
|
||||
|
||||
|
@ -72,7 +77,8 @@ USAGE:
|
|||
FLAGS:
|
||||
-c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static HIDE_ENV_VALS_FLAG: &str = "ctest 0.1
|
||||
|
||||
|
@ -82,7 +88,8 @@ USAGE:
|
|||
FLAGS:
|
||||
-c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR]
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static SHOW_ENV_VALS_FLAG: &str = "ctest 0.1
|
||||
|
||||
|
@ -92,7 +99,8 @@ USAGE:
|
|||
FLAGS:
|
||||
-c, --cafe A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hide_env() {
|
||||
|
|
|
@ -17,7 +17,8 @@ FLAGS:
|
|||
-V, --version Print version information
|
||||
|
||||
OPTIONS:
|
||||
--option <opt> some option";
|
||||
--option <opt> some option
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_args() {
|
||||
|
@ -51,7 +52,8 @@ USAGE:
|
|||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-v, --visible This text should be visible
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
static HIDDEN_SHORT_ARGS_LONG_HELP: &str = "test 2.31.2
|
||||
|
||||
|
@ -73,7 +75,8 @@ FLAGS:
|
|||
This text should be visible
|
||||
|
||||
-V, --version
|
||||
Print version information";
|
||||
Print version information
|
||||
";
|
||||
|
||||
/// Ensure hidden with short option
|
||||
#[test]
|
||||
|
@ -146,7 +149,8 @@ FLAGS:
|
|||
This text should be visible
|
||||
|
||||
-V, --version
|
||||
Print version information";
|
||||
Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_long_args() {
|
||||
|
@ -187,7 +191,8 @@ FLAGS:
|
|||
-c, --config Some help text describing the --config arg
|
||||
-h, --help Print help information
|
||||
-v, --visible This text should be visible
|
||||
-V, --version Print version information";
|
||||
-V, --version Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_long_args_short_help() {
|
||||
|
@ -221,7 +226,8 @@ USAGE:
|
|||
test [OPTIONS]
|
||||
|
||||
OPTIONS:
|
||||
--option <opt> some option";
|
||||
--option <opt> some option
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_flag_args() {
|
||||
|
@ -246,7 +252,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
--flag some flag
|
||||
-h, --help Print help information";
|
||||
-h, --help Print help information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_opt_args() {
|
||||
|
@ -275,7 +282,8 @@ ARGS:
|
|||
<another> another pos
|
||||
|
||||
FLAGS:
|
||||
-h, --help Print help information";
|
||||
-h, --help Print help information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_pos_args() {
|
||||
|
@ -301,7 +309,8 @@ USAGE:
|
|||
test
|
||||
|
||||
FLAGS:
|
||||
-h, --help Print help information";
|
||||
-h, --help Print help information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_subcmds() {
|
||||
|
@ -323,7 +332,8 @@ static HIDDEN_FLAG_ARGS_ONLY: &str = "test 1.4
|
|||
USAGE:
|
||||
test
|
||||
|
||||
After help";
|
||||
After help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_flag_args_only() {
|
||||
|
@ -346,7 +356,8 @@ static HIDDEN_OPT_ARGS_ONLY: &str = "test 1.4
|
|||
USAGE:
|
||||
test
|
||||
|
||||
After help";
|
||||
After help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_opt_args_only() {
|
||||
|
@ -370,7 +381,8 @@ static HIDDEN_POS_ARGS_ONLY: &str = "test 1.4
|
|||
USAGE:
|
||||
test
|
||||
|
||||
After help";
|
||||
After help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_pos_args_only() {
|
||||
|
@ -394,7 +406,8 @@ static HIDDEN_SUBCMDS_ONLY: &str = "test 1.4
|
|||
USAGE:
|
||||
test
|
||||
|
||||
After help";
|
||||
After help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn hidden_subcmds_only() {
|
||||
|
|
|
@ -22,7 +22,8 @@ OPTIONS:
|
|||
SUBCOMMANDS:
|
||||
0 Set everything to zero priority
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
view-tasks View all tasks";
|
||||
view-tasks View all tasks
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn basic() {
|
||||
|
|
|
@ -13,7 +13,8 @@ static DYM: &str =
|
|||
USAGE:
|
||||
clap-test --option <opt>...
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[cfg(feature = "suggestions")]
|
||||
static DYM_ISSUE_1073: &str =
|
||||
|
@ -26,7 +27,8 @@ static DYM_ISSUE_1073: &str =
|
|||
USAGE:
|
||||
ripgrep-616 --files-without-match
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn require_equals_fail() {
|
||||
|
@ -51,7 +53,8 @@ fn require_equals_fail_message() {
|
|||
USAGE:
|
||||
prog [OPTIONS]
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
let app = App::new("prog").arg(
|
||||
Arg::new("cfg")
|
||||
.setting(ArgSettings::RequireEquals)
|
||||
|
|
|
@ -11,7 +11,8 @@ static PV_ERROR: &str = "error: \"slo\" isn't a valid value for '-O <option>'
|
|||
USAGE:
|
||||
clap-test -O <option>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[cfg(not(feature = "suggestions"))]
|
||||
static PV_ERROR: &'static str = "error: \"slo\" isn't a valid value for '-O <option>'
|
||||
|
@ -20,7 +21,8 @@ static PV_ERROR: &'static str = "error: \"slo\" isn't a valid value for '-O <opt
|
|||
USAGE:
|
||||
clap-test -O <option>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[cfg(feature = "suggestions")]
|
||||
static PV_ERROR_ESCAPED: &str = "error: \"ludicrous\" isn't a valid value for '-O <option>'
|
||||
|
@ -31,7 +33,8 @@ static PV_ERROR_ESCAPED: &str = "error: \"ludicrous\" isn't a valid value for '-
|
|||
USAGE:
|
||||
clap-test -O <option>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[cfg(not(feature = "suggestions"))]
|
||||
static PV_ERROR_ESCAPED: &'static str = "error: \"ludicrous\" isn't a valid value for '-O <option>'
|
||||
|
@ -40,7 +43,8 @@ static PV_ERROR_ESCAPED: &'static str = "error: \"ludicrous\" isn't a valid valu
|
|||
USAGE:
|
||||
clap-test -O <option>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn possible_values_of_positional() {
|
||||
|
|
|
@ -8,7 +8,8 @@ static REQUIRE_EQUALS: &str = "error: The following required arguments were not
|
|||
USAGE:
|
||||
clap-test --opt=<FILE>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
static REQUIRE_EQUALS_FILTERED: &str = "error: The following required arguments were not provided:
|
||||
--opt=<FILE>
|
||||
|
@ -16,7 +17,8 @@ static REQUIRE_EQUALS_FILTERED: &str = "error: The following required arguments
|
|||
USAGE:
|
||||
clap-test --opt=<FILE> --foo=<FILE>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
static REQUIRE_EQUALS_FILTERED_GROUP: &str =
|
||||
"error: The following required arguments were not provided:
|
||||
|
@ -25,7 +27,8 @@ static REQUIRE_EQUALS_FILTERED_GROUP: &str =
|
|||
USAGE:
|
||||
clap-test --opt=<FILE> --foo=<FILE> <--g1=<FILE>|--g2=<FILE>>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
static MISSING_REQ: &str = "error: The following required arguments were not provided:
|
||||
--long-option-2 <option2>
|
||||
|
@ -34,7 +37,8 @@ static MISSING_REQ: &str = "error: The following required arguments were not pro
|
|||
USAGE:
|
||||
clap-test --long-option-2 <option2> -F <positional2>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
static COND_REQ_IN_USAGE: &str = "error: The following required arguments were not provided:
|
||||
--output <output>
|
||||
|
@ -42,7 +46,8 @@ static COND_REQ_IN_USAGE: &str = "error: The following required arguments were n
|
|||
USAGE:
|
||||
test --target <target> --input <input> --output <output>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn flag_required() {
|
||||
|
@ -915,7 +920,8 @@ static ISSUE_1158: &str = "error: The following required arguments were not prov
|
|||
USAGE:
|
||||
example -x <X> -y <Y> -z <Z> <ID>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
fn issue_1158_app() -> App<'static> {
|
||||
App::new("example")
|
||||
|
@ -945,7 +951,8 @@ fn multiple_required_unless_usage_printing() {
|
|||
USAGE:
|
||||
test --c <c> --a <a> --b <b>
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
let app = App::new("test")
|
||||
.arg(
|
||||
Arg::new("a")
|
||||
|
|
|
@ -13,7 +13,8 @@ FLAGS:
|
|||
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
test Some help [aliases: dongle, done]";
|
||||
test Some help [aliases: dongle, done]
|
||||
";
|
||||
|
||||
static INVISIBLE_ALIAS_HELP: &str = "clap-test 2.6
|
||||
|
||||
|
@ -26,7 +27,8 @@ FLAGS:
|
|||
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
test Some help";
|
||||
test Some help
|
||||
";
|
||||
|
||||
static SUBCMD_ALPHA_ORDER: &str = "test 1
|
||||
|
||||
|
@ -40,7 +42,8 @@ FLAGS:
|
|||
SUBCOMMANDS:
|
||||
a1 blah a1
|
||||
b1 blah b1
|
||||
help Print this message or the help of the given subcommand(s)";
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
";
|
||||
|
||||
static SUBCMD_DECL_ORDER: &str = "test 1
|
||||
|
||||
|
@ -54,7 +57,8 @@ FLAGS:
|
|||
SUBCOMMANDS:
|
||||
b1 blah b1
|
||||
a1 blah a1
|
||||
help Print this message or the help of the given subcommand(s)";
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
";
|
||||
|
||||
#[cfg(feature = "suggestions")]
|
||||
static DYM_SUBCMD: &str = "error: The subcommand 'subcm' wasn't recognized
|
||||
|
@ -66,7 +70,8 @@ If you believe you received this message in error, try re-running with 'dym -- s
|
|||
USAGE:
|
||||
dym [SUBCOMMAND]
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[cfg(feature = "suggestions")]
|
||||
static DYM_SUBCMD_AMBIGUOUS: &str = "error: The subcommand 'te' wasn't recognized
|
||||
|
@ -78,7 +83,8 @@ If you believe you received this message in error, try re-running with 'dym -- t
|
|||
USAGE:
|
||||
dym [SUBCOMMAND]
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
static SUBCMD_AFTER_DOUBLE_DASH: &str =
|
||||
"error: Found argument 'subcmd' which wasn't expected, or isn't valid in this context
|
||||
|
@ -88,7 +94,8 @@ static SUBCMD_AFTER_DOUBLE_DASH: &str =
|
|||
USAGE:
|
||||
app [SUBCOMMAND]
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn subcommand() {
|
||||
|
@ -241,7 +248,8 @@ fn subcmd_did_you_mean_output_arg() {
|
|||
USAGE:
|
||||
dym [SUBCOMMAND]
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
let app = App::new("dym")
|
||||
.subcommand(App::new("subcmd").arg(Arg::from("-s --subcmdarg [subcmdarg] 'tests'")));
|
||||
|
@ -265,7 +273,8 @@ fn subcmd_did_you_mean_output_arg_false_positives() {
|
|||
USAGE:
|
||||
dym [SUBCOMMAND]
|
||||
|
||||
For more information try --help";
|
||||
For more information try --help
|
||||
";
|
||||
|
||||
let app = App::new("dym")
|
||||
.subcommand(App::new("subcmd").arg(Arg::from("-s --subcmdarg [subcmdarg] 'tests'")));
|
||||
|
|
|
@ -44,7 +44,8 @@ ARGS:
|
|||
<output> Sets an optional output file
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
test does testing things";
|
||||
test does testing things
|
||||
";
|
||||
|
||||
static SIMPLE_TEMPLATE: &str = "MyApp 1.0
|
||||
Kevin K. <kbknapp@gmail.com>
|
||||
|
@ -66,7 +67,8 @@ OPTIONS:
|
|||
|
||||
SUBCOMMANDS:
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
test does testing things";
|
||||
test does testing things
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn with_template() {
|
||||
|
@ -97,7 +99,7 @@ fn template_empty() {
|
|||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.about("Does awesome things")
|
||||
.help_template("");
|
||||
assert!(utils::compare_output(app, "MyApp --help", "", false));
|
||||
assert!(utils::compare_output(app, "MyApp --help", "\n", false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -110,7 +112,7 @@ fn template_notag() {
|
|||
assert!(utils::compare_output(
|
||||
app,
|
||||
"MyApp --help",
|
||||
"test no tag test",
|
||||
"test no tag test\n",
|
||||
false
|
||||
));
|
||||
}
|
||||
|
@ -125,7 +127,7 @@ fn template_unknowntag() {
|
|||
assert!(utils::compare_output(
|
||||
app,
|
||||
"MyApp --help",
|
||||
"test {unknown_tag} test",
|
||||
"test {unknown_tag} test\n",
|
||||
false
|
||||
));
|
||||
}
|
||||
|
@ -140,7 +142,7 @@ fn template_author_version() {
|
|||
assert!(utils::compare_output(
|
||||
app,
|
||||
"MyApp --help",
|
||||
"Kevin K. <kbknapp@gmail.com>\n1.0\nDoes awesome things\nMyApp",
|
||||
"Kevin K. <kbknapp@gmail.com>\n1.0\nDoes awesome things\nMyApp\n",
|
||||
false
|
||||
));
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ where
|
|||
{
|
||||
let re = Regex::new("\x1b[^m]*m").unwrap();
|
||||
// Strip out any mismatching \r character on windows that might sneak in on either side
|
||||
let ls = l.as_ref().trim().replace("\r", "");
|
||||
let rs = r.as_ref().trim().replace("\r", "");
|
||||
let ls = l.as_ref().replace("\r", "");
|
||||
let rs = r.as_ref().replace("\r", "");
|
||||
let left = re.replace_all(&*ls, "");
|
||||
let right = re.replace_all(&*rs, "");
|
||||
let b = left == right;
|
||||
|
|
|
@ -111,7 +111,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-v, --version Print version information";
|
||||
-v, --version Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn override_version_short() {
|
||||
|
@ -148,7 +149,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --vers Print version information";
|
||||
-V, --vers Print version information
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn override_version_long() {
|
||||
|
@ -185,7 +187,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version version info";
|
||||
-V, --version version info
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn override_version_about() {
|
||||
|
@ -214,7 +217,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print custom version about text";
|
||||
-V, --version Print custom version about text
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn version_about_multi_subcmd() {
|
||||
|
@ -249,7 +253,8 @@ USAGE:
|
|||
|
||||
FLAGS:
|
||||
-h, --help Print help information
|
||||
-V, --version Print custom version about text from multi";
|
||||
-V, --version Print custom version about text from multi
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn version_about_multi_subcmd_override() {
|
||||
|
|
Loading…
Reference in a new issue