Skip to content

Commit

Permalink
Merge pull request #4220 from epage/quote
Browse files Browse the repository at this point in the history
fix(parser): Quote the suggested help
  • Loading branch information
epage committed Sep 15, 2022
2 parents 0479d8e + 0184cf0 commit 71cdd24
Show file tree
Hide file tree
Showing 32 changed files with 87 additions and 87 deletions.
2 changes: 1 addition & 1 deletion examples/derive_ref/custom-bool.md
Expand Up @@ -25,7 +25,7 @@ error: The following required arguments were not provided:

Usage: custom-bool[EXE] --foo <FOO> <BOOM>

For more information try --help
For more information try '--help'

$ custom-bool --foo true false
[examples/derive_ref/custom-bool.rs:31] opt = Opt {
Expand Down
12 changes: 6 additions & 6 deletions examples/derive_ref/interop_tests.md
Expand Up @@ -41,7 +41,7 @@ error: Found argument '--unknown' which wasn't expected, or isn't valid in this

Usage: interop_augment_args[EXE] [OPTIONS]

For more information try --help
For more information try '--help'

```

Expand Down Expand Up @@ -78,7 +78,7 @@ error: Found argument '--unknown' which wasn't expected, or isn't valid in this

Usage: interop_augment_subcommands[EXE] derived [OPTIONS]

For more information try --help
For more information try '--help'

```

Expand All @@ -89,7 +89,7 @@ error: The subcommand 'unknown' wasn't recognized

Usage: interop_augment_subcommands[EXE] [COMMAND]

For more information try --help
For more information try '--help'

```

Expand Down Expand Up @@ -150,7 +150,7 @@ error: Found argument '--unknown' which wasn't expected, or isn't valid in this

Usage: interop_hand_subcommand[EXE] add [NAME]...

For more information try --help
For more information try '--help'

```

Expand Down Expand Up @@ -193,7 +193,7 @@ error: The subcommand 'unknown' wasn't recognized

Usage: interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>

For more information try --help
For more information try '--help'

```

Expand Down Expand Up @@ -249,6 +249,6 @@ error: Found argument '--unknown' which wasn't expected, or isn't valid in this

Usage: interop_flatten_hand_args[EXE] [OPTIONS]

For more information try --help
For more information try '--help'

```
2 changes: 1 addition & 1 deletion examples/escaped-positional-derive.md
Expand Up @@ -37,7 +37,7 @@ error: Found argument 'foo' which wasn't expected, or isn't valid in this contex

Usage: escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]

For more information try --help
For more information try '--help'

```

Expand Down
2 changes: 1 addition & 1 deletion examples/escaped-positional.md
Expand Up @@ -37,7 +37,7 @@ error: Found argument 'foo' which wasn't expected, or isn't valid in this contex

Usage: escaped-positional[EXE] [OPTIONS] [-- <SLOP>...]

For more information try --help
For more information try '--help'

```

Expand Down
2 changes: 1 addition & 1 deletion examples/pacman.md
Expand Up @@ -71,7 +71,7 @@ error: The argument '--search <search>...' cannot be used with '--info'

Usage: pacman[EXE] {sync|--sync|-S} --search <search>... <package>...

For more information try --help
For more information try '--help'

```

Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_builder/04_01_enum.md
Expand Up @@ -22,6 +22,6 @@ $ 04_01_enum medium
error: "medium" isn't a valid value for '<MODE>'
[possible values: fast, slow]

For more information try --help
For more information try '--help'

```
2 changes: 1 addition & 1 deletion examples/tutorial_builder/04_01_possible.md
Expand Up @@ -22,6 +22,6 @@ $ 04_01_possible medium
error: "medium" isn't a valid value for '<MODE>'
[possible values: fast, slow]

For more information try --help
For more information try '--help'

```
4 changes: 2 additions & 2 deletions examples/tutorial_builder/04_02_parse.md
Expand Up @@ -18,12 +18,12 @@ $ 04_02_parse foobar
? failed
error: Invalid value "foobar" for '<PORT>': invalid digit found in string

For more information try --help
For more information try '--help'

$ 04_02_parse_derive 0
? failed
error: Invalid value "0" for '<PORT>': 0 is not in 1..=65535

For more information try --help
For more information try '--help'

```
4 changes: 2 additions & 2 deletions examples/tutorial_builder/04_02_validate.md
Expand Up @@ -18,12 +18,12 @@ $ 04_02_validate foobar
? failed
error: Invalid value "foobar" for '<PORT>': `foobar` isn't a port number

For more information try --help
For more information try '--help'

$ 04_02_validate 0
? failed
error: Invalid value "0" for '<PORT>': Port not in range 1-65535

For more information try --help
For more information try '--help'

```
6 changes: 3 additions & 3 deletions examples/tutorial_builder/04_03_relations.md
Expand Up @@ -24,7 +24,7 @@ error: The following required arguments were not provided:

Usage: 04_03_relations[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]

For more information try --help
For more information try '--help'

$ 04_03_relations --major
Version: 2.2.3
Expand All @@ -35,7 +35,7 @@ error: The argument '--major' cannot be used with '--minor'

Usage: 04_03_relations[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]

For more information try --help
For more information try '--help'

$ 04_03_relations --major -c config.toml
? failed
Expand All @@ -44,7 +44,7 @@ error: The following required arguments were not provided:

Usage: 04_03_relations[EXE] -c <CONFIG> <--set-ver <VER>|--major|--minor|--patch> <INPUT_FILE|--spec-in <SPEC_IN>>

For more information try --help
For more information try '--help'

$ 04_03_relations --major -c config.toml --spec-in input.txt
Version: 2.2.3
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial_builder/04_04_custom.md
Expand Up @@ -23,7 +23,7 @@ error: Can only modify one version field

Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]

For more information try --help
For more information try '--help'

$ 04_04_custom --major
Version: 2.2.3
Expand All @@ -34,7 +34,7 @@ error: Can only modify one version field

Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]

For more information try --help
For more information try '--help'

$ 04_04_custom --major -c config.toml
? failed
Expand All @@ -43,7 +43,7 @@ error: INPUT_FILE or --spec-in is required when using --config

Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE]

For more information try --help
For more information try '--help'

$ 04_04_custom --major -c config.toml --spec-in input.txt
Version: 2.2.3
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/04_01_enum.md
Expand Up @@ -22,6 +22,6 @@ $ 04_01_enum_derive medium
error: "medium" isn't a valid value for '<MODE>'
[possible values: fast, slow]

For more information try --help
For more information try '--help'

```
4 changes: 2 additions & 2 deletions examples/tutorial_derive/04_02_parse.md
Expand Up @@ -18,12 +18,12 @@ $ 04_02_parse_derive foobar
? failed
error: Invalid value "foobar" for '<PORT>': invalid digit found in string

For more information try --help
For more information try '--help'

$ 04_02_parse_derive 0
? failed
error: Invalid value "0" for '<PORT>': 0 is not in 1..=65535

For more information try --help
For more information try '--help'

```
4 changes: 2 additions & 2 deletions examples/tutorial_derive/04_02_validate.md
Expand Up @@ -18,12 +18,12 @@ $ 04_02_validate_derive foobar
? failed
error: Invalid value "foobar" for '<PORT>': `foobar` isn't a port number

For more information try --help
For more information try '--help'

$ 04_02_validate_derive 0
? failed
error: Invalid value "0" for '<PORT>': Port not in range 1-65535

For more information try --help
For more information try '--help'

```
6 changes: 3 additions & 3 deletions examples/tutorial_derive/04_03_relations.md
Expand Up @@ -24,7 +24,7 @@ error: The following required arguments were not provided:

Usage: 04_03_relations_derive[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]

For more information try --help
For more information try '--help'

$ 04_03_relations_derive --major
Version: 2.2.3
Expand All @@ -35,7 +35,7 @@ error: The argument '--major' cannot be used with '--minor'

Usage: 04_03_relations_derive[EXE] <--set-ver <VER>|--major|--minor|--patch> [INPUT_FILE]

For more information try --help
For more information try '--help'

$ 04_03_relations_derive --major -c config.toml
? failed
Expand All @@ -44,7 +44,7 @@ error: The following required arguments were not provided:

Usage: 04_03_relations_derive[EXE] -c <CONFIG> <--set-ver <VER>|--major|--minor|--patch> <INPUT_FILE|--spec-in <SPEC_IN>>

For more information try --help
For more information try '--help'

$ 04_03_relations_derive --major -c config.toml --spec-in input.txt
Version: 2.2.3
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorial_derive/04_04_custom.md
Expand Up @@ -23,7 +23,7 @@ error: Can only modify one version field

Usage: clap [OPTIONS] [INPUT_FILE]

For more information try --help
For more information try '--help'

$ 04_04_custom_derive --major
Version: 2.2.3
Expand All @@ -34,7 +34,7 @@ error: Can only modify one version field

Usage: clap [OPTIONS] [INPUT_FILE]

For more information try --help
For more information try '--help'

$ 04_04_custom_derive --major -c config.toml
? failed
Expand All @@ -43,7 +43,7 @@ error: INPUT_FILE or --spec-in is required when using --config

Usage: clap [OPTIONS] [INPUT_FILE]

For more information try --help
For more information try '--help'

$ 04_04_custom_derive --major -c config.toml --spec-in input.txt
Version: 2.2.3
Expand Down
10 changes: 5 additions & 5 deletions examples/typed-derive.md
Expand Up @@ -24,7 +24,7 @@ $ typed-derive -O plaid
? failed
error: Invalid value "plaid" for '-O <OPTIMIZATION>': invalid digit found in string

For more information try --help
For more information try '--help'

```

Expand All @@ -44,7 +44,7 @@ $ typed-derive --bind localhost
? failed
error: Invalid value "localhost" for '--bind <BIND>': invalid IP address syntax

For more information try --help
For more information try '--help'

```

Expand All @@ -57,7 +57,7 @@ $ typed-derive --sleep forever
? failed
error: Invalid value "forever" for '--sleep <SLEEP>': expected number at 0

For more information try --help
For more information try '--help'

```

Expand All @@ -70,12 +70,12 @@ $ typed-derive -D Foo
? failed
error: Invalid value "Foo" for '-D <DEFINES>': invalid KEY=value: no `=` found in `Foo`

For more information try --help
For more information try '--help'

$ typed-derive -D Foo=Bar
? failed
error: Invalid value "Foo=Bar" for '-D <DEFINES>': invalid digit found in string

For more information try --help
For more information try '--help'

```
4 changes: 2 additions & 2 deletions src/error/format.rs
Expand Up @@ -442,9 +442,9 @@ pub(crate) fn get_help_flag(cmd: &Command) -> Option<&'static str> {

fn try_help(styled: &mut StyledStr, help: Option<&str>) {
if let Some(help) = help {
styled.none("\n\nFor more information try ");
styled.none("\n\nFor more information try '");
styled.good(help.to_owned());
styled.none("\n");
styled.none("'\n");
} else {
styled.none("\n");
}
Expand Down
10 changes: 5 additions & 5 deletions tests/builder/conflicts.rs
Expand Up @@ -277,7 +277,7 @@ error: The argument '--flag...' cannot be used with '-F'
Usage: clap-test --flag... --long-option-2 <option2> <positional> <positional2> [positional3]...
For more information try --help
For more information try '--help'
";

utils::assert_output(
Expand All @@ -295,7 +295,7 @@ error: The argument '-F' cannot be used with '--flag...'
Usage: clap-test -F --long-option-2 <option2> <positional> <positional2> [positional3]...
For more information try --help
For more information try '--help'
";

utils::assert_output(
Expand All @@ -313,7 +313,7 @@ error: The argument '--flag...' cannot be used with '-F'
Usage: clap-test --flag... --long-option-2 <option2> <positional> <positional2> [positional3]...
For more information try --help
For more information try '--help'
";

utils::assert_output(
Expand All @@ -331,7 +331,7 @@ error: The argument '-F' cannot be used with '--flag...'
Usage: clap-test -F --long-option-2 <option2> <positional> <positional2> [positional3]...
For more information try --help
For more information try '--help'
";

utils::assert_output(
Expand All @@ -351,7 +351,7 @@ error: The argument '--one' cannot be used with:
Usage: three_conflicting_arguments --one
For more information try --help
For more information try '--help'
";

let cmd = Command::new("three_conflicting_arguments")
Expand Down
2 changes: 1 addition & 1 deletion tests/builder/default_vals.rs
Expand Up @@ -713,7 +713,7 @@ error: The following required arguments were not provided:
Usage: bug <input>
For more information try --help
For more information try '--help'
",
true,
);
Expand Down

0 comments on commit 71cdd24

Please sign in to comment.