From d3fc37b6787de5bcf5131a0bbb55c578a4f5cfa2 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 7 Sep 2022 15:07:23 -0500 Subject: [PATCH 1/5] fix(help): Long-only indentation is independent of TAB --- src/output/help.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output/help.rs b/src/output/help.rs index 68476e1c17f..9f1965ada1d 100644 --- a/src/output/help.rs +++ b/src/output/help.rs @@ -476,7 +476,7 @@ impl<'cmd, 'writer> Help<'cmd, 'writer> { if let Some(s) = arg.get_short() { self.literal(format!("-{}", s)); } else if arg.get_long().is_some() { - self.none(TAB) + self.none(" "); } } From 876da97d1ccebf84b15a25df7a9e895bdf6a2fdd Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 7 Sep 2022 15:52:26 -0500 Subject: [PATCH 2/5] fix(help): Make next-line help less sensitive to tab changes --- src/output/help.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/output/help.rs b/src/output/help.rs index 9f1965ada1d..1319bc817b9 100644 --- a/src/output/help.rs +++ b/src/output/help.rs @@ -547,11 +547,13 @@ impl<'cmd, 'writer> Help<'cmd, 'writer> { // Is help on next line, if so then indent if next_line_help { debug!("Help::help: Next Line...{:?}", next_line_help); - self.none(format!("\n{}{}{}", TAB, TAB, TAB)); + self.none("\n"); + self.none(TAB); + self.none(NEXT_LINE_INDENT); } let trailing_indent = if next_line_help { - TAB_WIDTH * 3 + TAB.len() + NEXT_LINE_INDENT.len() } else if let Some(true) = arg.map(|a| a.is_positional()) { longest + TAB_WIDTH * 2 } else { @@ -560,7 +562,7 @@ impl<'cmd, 'writer> Help<'cmd, 'writer> { let trailing_indent = self.get_spaces(trailing_indent); let spaces = if next_line_help { - TAB_WIDTH * 3 + TAB.len() + NEXT_LINE_INDENT.len() } else { longest + TAB_WIDTH * 3 }; @@ -932,6 +934,8 @@ impl<'cmd, 'writer> Help<'cmd, 'writer> { } } +const NEXT_LINE_INDENT: &str = " "; + type ArgSortKey = fn(arg: &Arg) -> (usize, String); fn positional_sort_key(arg: &Arg) -> (usize, String) { From 56fe50eab8a20d79af22db42a2f8a979d3df44cf Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 7 Sep 2022 16:37:27 -0500 Subject: [PATCH 3/5] fix(help): I think this fixes a bug? The existing behavior is hard to explain, so this is the best I've figured is going on. --- src/output/help.rs | 9 ++------- tests/builder/help.rs | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/output/help.rs b/src/output/help.rs index 1319bc817b9..cd61d56ded3 100644 --- a/src/output/help.rs +++ b/src/output/help.rs @@ -552,20 +552,16 @@ impl<'cmd, 'writer> Help<'cmd, 'writer> { self.none(NEXT_LINE_INDENT); } - let trailing_indent = if next_line_help { + let spaces = if next_line_help { TAB.len() + NEXT_LINE_INDENT.len() } else if let Some(true) = arg.map(|a| a.is_positional()) { longest + TAB_WIDTH * 2 } else { longest + TAB_WIDTH * 3 }; + let trailing_indent = spaces; // Don't indent any further than the first line is indented let trailing_indent = self.get_spaces(trailing_indent); - let spaces = if next_line_help { - TAB.len() + NEXT_LINE_INDENT.len() - } else { - longest + TAB_WIDTH * 3 - }; let mut help = about.clone(); help.replace_newline(); if !spec_vals.is_empty() { @@ -590,7 +586,6 @@ impl<'cmd, 'writer> Help<'cmd, 'writer> { help.indent("", &trailing_indent); let help_is_empty = help.is_empty(); self.writer.extend(help.into_iter()); - if let Some(arg) = arg { const DASH_SPACE: usize = "- ".len(); const COLON_SPACE: usize = ": ".len(); diff --git a/tests/builder/help.rs b/tests/builder/help.rs index c1b99559952..be3f6531794 100644 --- a/tests/builder/help.rs +++ b/tests/builder/help.rs @@ -755,8 +755,8 @@ Arguments: symbols. l, long Copy-friendly, 14 characters, contains symbols. - m, med, medium Copy-friendly, 8 - characters, contains symbols. + m, med, medium Copy-friendly, 8 characters, + contains symbols. Options: -h, --help Print help information From ed6475e9deab0ccf7e228cc97b89fa21802337e9 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 7 Sep 2022 16:39:14 -0500 Subject: [PATCH 4/5] fix(help): Clarify what is tab dependent and what isn't --- src/output/help.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output/help.rs b/src/output/help.rs index cd61d56ded3..0ef6934315d 100644 --- a/src/output/help.rs +++ b/src/output/help.rs @@ -557,7 +557,7 @@ impl<'cmd, 'writer> Help<'cmd, 'writer> { } else if let Some(true) = arg.map(|a| a.is_positional()) { longest + TAB_WIDTH * 2 } else { - longest + TAB_WIDTH * 3 + longest + TAB_WIDTH * 2 + 4 // See `fn short` for the 4 }; let trailing_indent = spaces; // Don't indent any further than the first line is indented let trailing_indent = self.get_spaces(trailing_indent); From c90a4eabaea88500777b04c40ba314ae28c3040f Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 7 Sep 2022 15:29:15 -0500 Subject: [PATCH 5/5] fix(help): Make output more dense In looking at other help output, I noticed that they use two spaces, in place of clap's 4, and it doesn't suffer from legibility. If it doesn't make the output worse, let's go ahead and make it as dense so we fit more content on the screen. This is a part of #4132 --- CHANGELOG.md | 14 +- examples/cargo-example-derive.md | 12 +- examples/cargo-example.md | 12 +- examples/demo.md | 8 +- examples/derive_ref/custom-bool.md | 14 +- examples/derive_ref/interop_tests.md | 18 +- examples/escaped-positional-derive.md | 10 +- examples/escaped-positional.md | 10 +- examples/find.md | 14 +- examples/git-derive.md | 64 +- examples/git.md | 64 +- examples/multicall-busybox.md | 10 +- examples/pacman.md | 18 +- examples/tutorial_builder/01_quick.md | 14 +- examples/tutorial_builder/02_app_settings.md | 16 +- examples/tutorial_builder/02_apps.md | 8 +- examples/tutorial_builder/02_crate.md | 8 +- examples/tutorial_builder/03_01_flag_bool.md | 6 +- examples/tutorial_builder/03_01_flag_count.md | 6 +- examples/tutorial_builder/03_02_option.md | 6 +- .../tutorial_builder/03_02_option_mult.md | 6 +- examples/tutorial_builder/03_03_positional.md | 6 +- .../tutorial_builder/03_03_positional_mult.md | 6 +- .../tutorial_builder/03_04_subcommands.md | 22 +- .../tutorial_builder/03_05_default_values.md | 6 +- examples/tutorial_builder/04_01_enum.md | 8 +- examples/tutorial_builder/04_01_possible.md | 8 +- examples/tutorial_builder/04_02_parse.md | 6 +- examples/tutorial_builder/04_02_validate.md | 6 +- examples/tutorial_builder/04_03_relations.md | 22 +- examples/tutorial_builder/04_04_custom.md | 18 +- examples/tutorial_derive/01_quick.md | 14 +- examples/tutorial_derive/02_app_settings.md | 16 +- examples/tutorial_derive/02_apps.md | 8 +- examples/tutorial_derive/02_crate.md | 8 +- examples/tutorial_derive/03_01_flag_bool.md | 6 +- examples/tutorial_derive/03_01_flag_count.md | 6 +- examples/tutorial_derive/03_02_option.md | 6 +- examples/tutorial_derive/03_02_option_mult.md | 6 +- examples/tutorial_derive/03_03_positional.md | 6 +- .../tutorial_derive/03_03_positional_mult.md | 6 +- examples/tutorial_derive/03_04_subcommands.md | 22 +- .../tutorial_derive/03_05_default_values.md | 6 +- examples/tutorial_derive/04_01_enum.md | 8 +- examples/tutorial_derive/04_02_parse.md | 6 +- examples/tutorial_derive/04_02_validate.md | 6 +- examples/tutorial_derive/04_03_relations.md | 22 +- examples/tutorial_derive/04_04_custom.md | 18 +- examples/typed-derive.md | 12 +- src/output/mod.rs | 2 +- tests/builder/app_settings.rs | 34 +- tests/builder/arg_aliases.rs | 16 +- tests/builder/arg_aliases_short.rs | 16 +- tests/builder/cargo.rs | 8 +- tests/builder/command.rs | 4 +- tests/builder/conflicts.rs | 19 +- tests/builder/default_vals.rs | 5 +- tests/builder/derive_order.rs | 92 +-- tests/builder/display_order.rs | 6 +- tests/builder/double_require.rs | 18 +- tests/builder/error.rs | 4 +- tests/builder/flag_subcommands.rs | 18 +- tests/builder/flags.rs | 12 +- tests/builder/groups.rs | 14 +- tests/builder/help.rs | 714 +++++++++--------- tests/builder/help_env.rs | 48 +- tests/builder/hidden_args.rs | 60 +- tests/builder/multiple_values.rs | 4 +- tests/builder/opts.rs | 16 +- tests/builder/possible_values.rs | 30 +- tests/builder/require.rs | 68 +- tests/builder/subcommands.rs | 66 +- tests/builder/template_help.rs | 28 +- tests/builder/version.rs | 28 +- tests/derive/help.rs | 50 +- tests/macros.rs | 4 +- tests/ui/arg_required_else_help_stderr.toml | 10 +- tests/ui/error_stderr.toml | 2 +- tests/ui/h_flag_stdout.toml | 10 +- tests/ui/help_cmd_stdout.toml | 20 +- tests/ui/help_flag_stdout.toml | 20 +- 81 files changed, 1047 insertions(+), 1027 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3045b99cbc1..9ed65e2488c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,14 +69,14 @@ A fictional versioning CLI Usage: git Commands: - clone Clones repos - push pushes things - add adds things - stash - help Print this message or the help of the given subcommand(s) + clone Clones repos + push pushes things + add adds things + stash + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information + -h, --help Print help information ``` - name/version header was removed because we couldn't justify the space it occupied when - Usage already includes the name @@ -85,6 +85,7 @@ Options: - Focus is put on the subcommands - Headings are now Title case - The more general term "command" is used rather than being explicit about being "subcommands" +- The output is more dense with the expectation that it won't affect legibility but will allow more content - We've moved to a more neutral palette for highlighting elements (not highlighted above) In talking to users, we found some that liked clap's `man`-like experience. @@ -260,6 +261,7 @@ Deprecated - *(help)* Hint to the user the difference between `-h` / `--help` when applicable (#4132, #4159) - *(help)* Shorten help by eliding name/version/author (#4132, #4160) - *(help)* When short help is long enough to activate `next_line_help`, don't add blank lines (#4132, #4190) +- *(help)* Make help output more dense (reducing horizontal whitespace) (#4132, #4192) - *(version)* Use `Command::display_name` rather than `Command::bin_name` (#3966) - *(parser)* Always fill in `""` argument for external subcommands (#3263) - *(parser)* Short flags now have higher precedence than hyphen values with `Arg::allow_hyphen_values`, like `Command::allow_hyphen_values` (#4187) diff --git a/examples/cargo-example-derive.md b/examples/cargo-example-derive.md index f1737e05869..99cbb2f162d 100644 --- a/examples/cargo-example-derive.md +++ b/examples/cargo-example-derive.md @@ -9,11 +9,11 @@ $ cargo-example-derive --help Usage: cargo Commands: - example-derive A simple to use, efficient, and full-featured Command Line Argument Parser - help Print this message or the help of the given subcommand(s) + example-derive A simple to use, efficient, and full-featured Command Line Argument Parser + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information + -h, --help Print help information $ cargo-example-derive example-derive --help A simple to use, efficient, and full-featured Command Line Argument Parser @@ -21,9 +21,9 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: cargo example-derive [OPTIONS] Options: - --manifest-path - -h, --help Print help information - -V, --version Print version information + --manifest-path + -h, --help Print help information + -V, --version Print version information ``` diff --git a/examples/cargo-example.md b/examples/cargo-example.md index ccb33b54f8f..caafbad11d2 100644 --- a/examples/cargo-example.md +++ b/examples/cargo-example.md @@ -9,11 +9,11 @@ $ cargo-example --help Usage: cargo Commands: - example A simple to use, efficient, and full-featured Command Line Argument Parser - help Print this message or the help of the given subcommand(s) + example A simple to use, efficient, and full-featured Command Line Argument Parser + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information + -h, --help Print help information $ cargo-example example --help A simple to use, efficient, and full-featured Command Line Argument Parser @@ -21,9 +21,9 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: cargo example [OPTIONS] Options: - --manifest-path - -h, --help Print help information - -V, --version Print version information + --manifest-path + -h, --help Print help information + -V, --version Print version information ``` diff --git a/examples/demo.md b/examples/demo.md index 98bd4514ce8..2a9ed94ccb1 100644 --- a/examples/demo.md +++ b/examples/demo.md @@ -5,10 +5,10 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: demo[EXE] [OPTIONS] --name Options: - -n, --name Name of the person to greet - -c, --count Number of times to greet [default: 1] - -h, --help Print help information - -V, --version Print version information + -n, --name Name of the person to greet + -c, --count Number of times to greet [default: 1] + -h, --help Print help information + -V, --version Print version information $ demo --name Me Hello Me! diff --git a/examples/derive_ref/custom-bool.md b/examples/derive_ref/custom-bool.md index bce4bc5cdad..9a1d9d74960 100644 --- a/examples/derive_ref/custom-bool.md +++ b/examples/derive_ref/custom-bool.md @@ -9,19 +9,19 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: custom-bool[EXE] [OPTIONS] --foo Arguments: - [possible values: true, false] + [possible values: true, false] Options: - --foo [possible values: true, false] - --bar [default: false] - -h, --help Print help information - -V, --version Print version information + --foo [possible values: true, false] + --bar [default: false] + -h, --help Print help information + -V, --version Print version information $ custom-bool ? failed error: The following required arguments were not provided: - --foo - + --foo + Usage: custom-bool[EXE] --foo diff --git a/examples/derive_ref/interop_tests.md b/examples/derive_ref/interop_tests.md index d30c857e5c2..c891654e827 100644 --- a/examples/derive_ref/interop_tests.md +++ b/examples/derive_ref/interop_tests.md @@ -37,7 +37,7 @@ $ interop_augment_args --unknown ? failed error: Found argument '--unknown' which wasn't expected, or isn't valid in this context - If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` + If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` Usage: interop_augment_args[EXE] [OPTIONS] @@ -74,7 +74,7 @@ $ interop_augment_subcommands derived --unknown ? failed error: Found argument '--unknown' which wasn't expected, or isn't valid in this context - If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` + If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` Usage: interop_augment_subcommands[EXE] derived [OPTIONS] @@ -101,13 +101,13 @@ $ interop_hand_subcommand Usage: interop_hand_subcommand[EXE] [OPTIONS] Commands: - add - remove - help Print this message or the help of the given subcommand(s) + add + remove + help Print this message or the help of the given subcommand(s) Options: - -t, --top-level - -h, --help Print help information + -t, --top-level + -h, --help Print help information ``` @@ -146,7 +146,7 @@ $ interop_hand_subcommand add --unknown ? failed error: Found argument '--unknown' which wasn't expected, or isn't valid in this context - If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` + If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` Usage: interop_hand_subcommand[EXE] add [NAME]... @@ -245,7 +245,7 @@ $ interop_flatten_hand_args --unknown ? failed error: Found argument '--unknown' which wasn't expected, or isn't valid in this context - If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` + If you tried to supply `--unknown` as a value rather than a flag, use `-- --unknown` Usage: interop_flatten_hand_args[EXE] [OPTIONS] diff --git a/examples/escaped-positional-derive.md b/examples/escaped-positional-derive.md index b82bddfcd97..8b957a6c9e4 100644 --- a/examples/escaped-positional-derive.md +++ b/examples/escaped-positional-derive.md @@ -10,13 +10,13 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: escaped-positional-derive[EXE] [OPTIONS] [-- ...] Arguments: - [SLOP]... + [SLOP]... Options: - -f - -p - -h, --help Print help information - -V, --version Print version information + -f + -p + -h, --help Print help information + -V, --version Print version information ``` diff --git a/examples/escaped-positional.md b/examples/escaped-positional.md index f0195091fbe..1ebea0628f3 100644 --- a/examples/escaped-positional.md +++ b/examples/escaped-positional.md @@ -10,13 +10,13 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: escaped-positional[EXE] [OPTIONS] [-- ...] Arguments: - [SLOP]... + [SLOP]... Options: - -f - -p - -h, --help Print help information - -V, --version Print version information + -f + -p + -h, --help Print help information + -V, --version Print version information ``` diff --git a/examples/find.md b/examples/find.md index 4a18e4456cf..fb9323989cf 100644 --- a/examples/find.md +++ b/examples/find.md @@ -7,17 +7,17 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: find[EXE] [OPTIONS] --name Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information TESTS: - --empty File is empty and is either a regular file or a directory - --name Base of file name (the path with the leading directories removed) matches - shell pattern pattern + --empty File is empty and is either a regular file or a directory + --name Base of file name (the path with the leading directories removed) matches shell + pattern pattern OPERATORS: - -o, --or expr2 is not evaluate if exp1 is true - -a, --and Same as `expr1 expr1` + -o, --or expr2 is not evaluate if exp1 is true + -a, --and Same as `expr1 expr1` $ find --empty -o --name .keep [ diff --git a/examples/git-derive.md b/examples/git-derive.md index d669ba24610..15a58e9decf 100644 --- a/examples/git-derive.md +++ b/examples/git-derive.md @@ -11,15 +11,15 @@ A fictional versioning CLI Usage: git-derive[EXE] Commands: - clone Clones repos - diff Compare two commits - push pushes things - add adds things - stash - help Print this message or the help of the given subcommand(s) + clone Clones repos + diff Compare two commits + push pushes things + add adds things + stash + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information + -h, --help Print help information $ git-derive help A fictional versioning CLI @@ -27,15 +27,15 @@ A fictional versioning CLI Usage: git-derive[EXE] Commands: - clone Clones repos - diff Compare two commits - push pushes things - add adds things - stash - help Print this message or the help of the given subcommand(s) + clone Clones repos + diff Compare two commits + push pushes things + add adds things + stash + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information + -h, --help Print help information $ git-derive help add adds things @@ -43,10 +43,10 @@ adds things Usage: git-derive[EXE] add ... Arguments: - ... Stuff to add + ... Stuff to add Options: - -h, --help Print help information + -h, --help Print help information ``` @@ -59,10 +59,10 @@ adds things Usage: git-derive[EXE] add ... Arguments: - ... Stuff to add + ... Stuff to add Options: - -h, --help Print help information + -h, --help Print help information $ git-derive add Cargo.toml Cargo.lock Adding ["Cargo.toml", "Cargo.lock"] @@ -76,30 +76,30 @@ Usage: git-derive[EXE] stash [OPTIONS] git-derive[EXE] stash Commands: - push - pop - apply - help Print this message or the help of the given subcommand(s) + push + pop + apply + help Print this message or the help of the given subcommand(s) Options: - -m, --message - -h, --help Print help information + -m, --message + -h, --help Print help information $ git-derive stash push -h Usage: git-derive[EXE] stash push [OPTIONS] Options: - -m, --message - -h, --help Print help information + -m, --message + -h, --help Print help information $ git-derive stash pop -h Usage: git-derive[EXE] stash pop [STASH] Arguments: - [STASH] + [STASH] Options: - -h, --help Print help information + -h, --help Print help information $ git-derive stash -m "Prototype" Pushing StashPush { message: Some("Prototype") } @@ -130,12 +130,12 @@ Compare two commits Usage: git-derive[EXE] diff [COMMIT] [COMMIT] [-- ] Arguments: - [COMMIT] - [COMMIT] - [PATH] + [COMMIT] + [COMMIT] + [PATH] Options: - -h, --help Print help information + -h, --help Print help information $ git-derive diff Diffing stage..worktree diff --git a/examples/git.md b/examples/git.md index c87463649cb..ea81e896d46 100644 --- a/examples/git.md +++ b/examples/git.md @@ -9,15 +9,15 @@ A fictional versioning CLI Usage: git[EXE] Commands: - clone Clones repos - diff Compare two commits - push pushes things - add adds things - stash - help Print this message or the help of the given subcommand(s) + clone Clones repos + diff Compare two commits + push pushes things + add adds things + stash + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information + -h, --help Print help information $ git help A fictional versioning CLI @@ -25,15 +25,15 @@ A fictional versioning CLI Usage: git[EXE] Commands: - clone Clones repos - diff Compare two commits - push pushes things - add adds things - stash - help Print this message or the help of the given subcommand(s) + clone Clones repos + diff Compare two commits + push pushes things + add adds things + stash + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information + -h, --help Print help information $ git help add adds things @@ -41,10 +41,10 @@ adds things Usage: git[EXE] add ... Arguments: - ... Stuff to add + ... Stuff to add Options: - -h, --help Print help information + -h, --help Print help information ``` @@ -57,10 +57,10 @@ adds things Usage: git[EXE] add ... Arguments: - ... Stuff to add + ... Stuff to add Options: - -h, --help Print help information + -h, --help Print help information $ git add Cargo.toml Cargo.lock Adding ["Cargo.toml", "Cargo.lock"] @@ -74,30 +74,30 @@ Usage: git[EXE] stash [OPTIONS] git[EXE] stash Commands: - push - pop - apply - help Print this message or the help of the given subcommand(s) + push + pop + apply + help Print this message or the help of the given subcommand(s) Options: - -m, --message - -h, --help Print help information + -m, --message + -h, --help Print help information $ git stash push -h Usage: git[EXE] stash push [OPTIONS] Options: - -m, --message - -h, --help Print help information + -m, --message + -h, --help Print help information $ git stash pop -h Usage: git[EXE] stash pop [STASH] Arguments: - [STASH] + [STASH] Options: - -h, --help Print help information + -h, --help Print help information $ git stash -m "Prototype" Pushing Some("Prototype") @@ -128,12 +128,12 @@ Compare two commits Usage: git[EXE] diff [COMMIT] [COMMIT] [-- ] Arguments: - [COMMIT] - [COMMIT] - [PATH] + [COMMIT] + [COMMIT] + [PATH] Options: - -h, --help Print help information + -h, --help Print help information $ git diff Diffing stage..worktree diff --git a/examples/multicall-busybox.md b/examples/multicall-busybox.md index 32efe027c98..8ee93cc54e0 100644 --- a/examples/multicall-busybox.md +++ b/examples/multicall-busybox.md @@ -28,12 +28,12 @@ $ busybox Usage: busybox [OPTIONS] [APPLET] APPLETS: - true does nothing successfully - false does nothing unsuccessfully - help Print this message or the help of the given subcommand(s) + true does nothing successfully + false does nothing unsuccessfully + help Print this message or the help of the given subcommand(s) Options: - --install Install hardlinks for all subcommands in path - -h, --help Print help information + --install Install hardlinks for all subcommands in path + -h, --help Print help information ``` diff --git a/examples/pacman.md b/examples/pacman.md index a691c5ae5f9..505a3fa3af2 100644 --- a/examples/pacman.md +++ b/examples/pacman.md @@ -40,13 +40,13 @@ package manager utility Usage: pacman[EXE] Commands: - query -Q --query Query the package database. - sync -S --sync Synchronize packages. - help Print this message or the help of the given subcommand(s) + query -Q --query Query the package database. + sync -S --sync Synchronize packages. + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ pacman -S -h Synchronize packages. @@ -54,12 +54,12 @@ Synchronize packages. Usage: pacman[EXE] {sync|--sync|-S} [OPTIONS] [package]... Arguments: - [package]... packages + [package]... packages Options: - -s, --search ... search remote repositories for matching strings - -i, --info view package information - -h, --help Print help information + -s, --search ... search remote repositories for matching strings + -i, --info view package information + -h, --help Print help information ``` diff --git a/examples/tutorial_builder/01_quick.md b/examples/tutorial_builder/01_quick.md index 8675fb4c645..b9631517591 100644 --- a/examples/tutorial_builder/01_quick.md +++ b/examples/tutorial_builder/01_quick.md @@ -5,17 +5,17 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 01_quick[EXE] [OPTIONS] [name] [COMMAND] Commands: - test does testing things - help Print this message or the help of the given subcommand(s) + test does testing things + help Print this message or the help of the given subcommand(s) Arguments: - [name] Optional name to operate on + [name] 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 + -c, --config Sets a custom config file + -d, --debug... Turn debugging information on + -h, --help Print help information + -V, --version Print version information ``` diff --git a/examples/tutorial_builder/02_app_settings.md b/examples/tutorial_builder/02_app_settings.md index 95bce05131c..47fa61b2033 100644 --- a/examples/tutorial_builder/02_app_settings.md +++ b/examples/tutorial_builder/02_app_settings.md @@ -5,13 +5,13 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 02_app_settings[EXE] --two --one Options: - --two - - --one - - -h, --help - Print help information - -V, --version - Print version information + --two + + --one + + -h, --help + Print help information + -V, --version + Print version information ``` diff --git a/examples/tutorial_builder/02_apps.md b/examples/tutorial_builder/02_apps.md index 2f3deac0076..47379ce4786 100644 --- a/examples/tutorial_builder/02_apps.md +++ b/examples/tutorial_builder/02_apps.md @@ -5,10 +5,10 @@ Does awesome things Usage: 02_apps[EXE] --two --one Options: - --two - --one - -h, --help Print help information - -V, --version Print version information + --two + --one + -h, --help Print help information + -V, --version Print version information $ 02_apps --version MyApp 1.0 diff --git a/examples/tutorial_builder/02_crate.md b/examples/tutorial_builder/02_crate.md index a3417d30aa4..832f7f7c544 100644 --- a/examples/tutorial_builder/02_crate.md +++ b/examples/tutorial_builder/02_crate.md @@ -5,10 +5,10 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 02_crate[EXE] --two --one Options: - --two - --one - -h, --help Print help information - -V, --version Print version information + --two + --one + -h, --help Print help information + -V, --version Print version information $ 02_crate --version clap [..] diff --git a/examples/tutorial_builder/03_01_flag_bool.md b/examples/tutorial_builder/03_01_flag_bool.md index d4ae7040fde..c151af440a6 100644 --- a/examples/tutorial_builder/03_01_flag_bool.md +++ b/examples/tutorial_builder/03_01_flag_bool.md @@ -5,9 +5,9 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_01_flag_bool[EXE] [OPTIONS] Options: - -v, --verbose - -h, --help Print help information - -V, --version Print version information + -v, --verbose + -h, --help Print help information + -V, --version Print version information $ 03_01_flag_bool verbose: false diff --git a/examples/tutorial_builder/03_01_flag_count.md b/examples/tutorial_builder/03_01_flag_count.md index ee9f94404b5..95610a19b74 100644 --- a/examples/tutorial_builder/03_01_flag_count.md +++ b/examples/tutorial_builder/03_01_flag_count.md @@ -5,9 +5,9 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_01_flag_count[EXE] [OPTIONS] Options: - -v, --verbose... - -h, --help Print help information - -V, --version Print version information + -v, --verbose... + -h, --help Print help information + -V, --version Print version information $ 03_01_flag_count verbose: 0 diff --git a/examples/tutorial_builder/03_02_option.md b/examples/tutorial_builder/03_02_option.md index 0457ac4edd7..68dc25e8c93 100644 --- a/examples/tutorial_builder/03_02_option.md +++ b/examples/tutorial_builder/03_02_option.md @@ -5,9 +5,9 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_02_option[EXE] [OPTIONS] Options: - -n, --name - -h, --help Print help information - -V, --version Print version information + -n, --name + -h, --help Print help information + -V, --version Print version information $ 03_02_option name: None diff --git a/examples/tutorial_builder/03_02_option_mult.md b/examples/tutorial_builder/03_02_option_mult.md index a2161436a8f..21af5793736 100644 --- a/examples/tutorial_builder/03_02_option_mult.md +++ b/examples/tutorial_builder/03_02_option_mult.md @@ -5,9 +5,9 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_02_option_mult[EXE] [OPTIONS] Options: - -n, --name - -h, --help Print help information - -V, --version Print version information + -n, --name + -h, --help Print help information + -V, --version Print version information $ 03_02_option_mult name: None diff --git a/examples/tutorial_builder/03_03_positional.md b/examples/tutorial_builder/03_03_positional.md index 7918284761d..df54b02249a 100644 --- a/examples/tutorial_builder/03_03_positional.md +++ b/examples/tutorial_builder/03_03_positional.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_03_positional[EXE] [name] Arguments: - [name] + [name] Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 03_03_positional name: None diff --git a/examples/tutorial_builder/03_03_positional_mult.md b/examples/tutorial_builder/03_03_positional_mult.md index 2f9ff419729..f92b0f257dd 100644 --- a/examples/tutorial_builder/03_03_positional_mult.md +++ b/examples/tutorial_builder/03_03_positional_mult.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_03_positional_mult[EXE] [name]... Arguments: - [name]... + [name]... Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 03_03_positional_mult name: None diff --git a/examples/tutorial_builder/03_04_subcommands.md b/examples/tutorial_builder/03_04_subcommands.md index a2636dd7798..91a4a058169 100644 --- a/examples/tutorial_builder/03_04_subcommands.md +++ b/examples/tutorial_builder/03_04_subcommands.md @@ -5,12 +5,12 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_04_subcommands[EXE] Commands: - add Adds files to myapp - help Print this message or the help of the given subcommand(s) + add Adds files to myapp + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 03_04_subcommands help add Adds files to myapp @@ -18,11 +18,11 @@ Adds files to myapp Usage: 03_04_subcommands[EXE] add [NAME] Arguments: - [NAME] + [NAME] Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 03_04_subcommands add bob 'myapp add' was used, name is: Some("bob") @@ -38,12 +38,12 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_04_subcommands[EXE] Commands: - add Adds files to myapp - help Print this message or the help of the given subcommand(s) + add Adds files to myapp + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information ``` diff --git a/examples/tutorial_builder/03_05_default_values.md b/examples/tutorial_builder/03_05_default_values.md index 283c4ba2dc0..9954f3adbae 100644 --- a/examples/tutorial_builder/03_05_default_values.md +++ b/examples/tutorial_builder/03_05_default_values.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_05_default_values[EXE] [NAME] Arguments: - [NAME] [default: alice] + [NAME] [default: alice] Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 03_05_default_values name: "alice" diff --git a/examples/tutorial_builder/04_01_enum.md b/examples/tutorial_builder/04_01_enum.md index a9baa540659..405e5db84ce 100644 --- a/examples/tutorial_builder/04_01_enum.md +++ b/examples/tutorial_builder/04_01_enum.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 04_01_enum[EXE] Arguments: - What mode to run the program in [possible values: fast, slow] + What mode to run the program in [possible values: fast, slow] Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 04_01_enum fast Hare @@ -20,7 +20,7 @@ Tortoise $ 04_01_enum medium ? failed error: "medium" isn't a valid value for '' - [possible values: fast, slow] + [possible values: fast, slow] For more information try --help diff --git a/examples/tutorial_builder/04_01_possible.md b/examples/tutorial_builder/04_01_possible.md index a52b1245cb7..8ac76889a73 100644 --- a/examples/tutorial_builder/04_01_possible.md +++ b/examples/tutorial_builder/04_01_possible.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 04_01_possible[EXE] Arguments: - What mode to run the program in [possible values: fast, slow] + What mode to run the program in [possible values: fast, slow] Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 04_01_possible fast Hare @@ -20,7 +20,7 @@ Tortoise $ 04_01_possible medium ? failed error: "medium" isn't a valid value for '' - [possible values: fast, slow] + [possible values: fast, slow] For more information try --help diff --git a/examples/tutorial_builder/04_02_parse.md b/examples/tutorial_builder/04_02_parse.md index da6e81ad6d4..6b0b040f164 100644 --- a/examples/tutorial_builder/04_02_parse.md +++ b/examples/tutorial_builder/04_02_parse.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 04_02_parse[EXE] Arguments: - Network port to use + Network port to use Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 04_02_parse 22 PORT = 22 diff --git a/examples/tutorial_builder/04_02_validate.md b/examples/tutorial_builder/04_02_validate.md index 1e048d2a29e..f812e918b37 100644 --- a/examples/tutorial_builder/04_02_validate.md +++ b/examples/tutorial_builder/04_02_validate.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 04_02_validate[EXE] Arguments: - Network port to use + Network port to use Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 04_02_validate 22 PORT = 22 diff --git a/examples/tutorial_builder/04_03_relations.md b/examples/tutorial_builder/04_03_relations.md index d58521291a6..0dda5d3469b 100644 --- a/examples/tutorial_builder/04_03_relations.md +++ b/examples/tutorial_builder/04_03_relations.md @@ -5,22 +5,22 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 04_03_relations[EXE] [OPTIONS] <--set-ver |--major|--minor|--patch> [INPUT_FILE] Arguments: - [INPUT_FILE] some regular input + [INPUT_FILE] some regular input Options: - --set-ver set version manually - --major auto inc major - --minor auto inc minor - --patch auto inc patch - --spec-in some special input argument - -c - -h, --help Print help information - -V, --version Print version information + --set-ver set version manually + --major auto inc major + --minor auto inc minor + --patch auto inc patch + --spec-in some special input argument + -c + -h, --help Print help information + -V, --version Print version information $ 04_03_relations ? failed error: The following required arguments were not provided: - <--set-ver |--major|--minor|--patch> + <--set-ver |--major|--minor|--patch> Usage: 04_03_relations[EXE] <--set-ver |--major|--minor|--patch> [INPUT_FILE] @@ -40,7 +40,7 @@ For more information try --help $ 04_03_relations --major -c config.toml ? failed error: The following required arguments were not provided: - > + > Usage: 04_03_relations[EXE] -c <--set-ver |--major|--minor|--patch> > diff --git a/examples/tutorial_builder/04_04_custom.md b/examples/tutorial_builder/04_04_custom.md index 49f705fe36c..594454b712b 100644 --- a/examples/tutorial_builder/04_04_custom.md +++ b/examples/tutorial_builder/04_04_custom.md @@ -5,17 +5,17 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 04_04_custom[EXE] [OPTIONS] [INPUT_FILE] Arguments: - [INPUT_FILE] some regular input + [INPUT_FILE] some regular input Options: - --set-ver set version manually - --major auto inc major - --minor auto inc minor - --patch auto inc patch - --spec-in some special input argument - -c - -h, --help Print help information - -V, --version Print version information + --set-ver set version manually + --major auto inc major + --minor auto inc minor + --patch auto inc patch + --spec-in some special input argument + -c + -h, --help Print help information + -V, --version Print version information $ 04_04_custom ? failed diff --git a/examples/tutorial_derive/01_quick.md b/examples/tutorial_derive/01_quick.md index 7781ad3118d..1d9758439d4 100644 --- a/examples/tutorial_derive/01_quick.md +++ b/examples/tutorial_derive/01_quick.md @@ -5,17 +5,17 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 01_quick_derive[EXE] [OPTIONS] [NAME] [COMMAND] Commands: - test does testing things - help Print this message or the help of the given subcommand(s) + test does testing things + help Print this message or the help of the given subcommand(s) Arguments: - [NAME] Optional name to operate on + [NAME] 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 + -c, --config Sets a custom config file + -d, --debug... Turn debugging information on + -h, --help Print help information + -V, --version Print version information ``` diff --git a/examples/tutorial_derive/02_app_settings.md b/examples/tutorial_derive/02_app_settings.md index 827abe66b1a..fa21fda8834 100644 --- a/examples/tutorial_derive/02_app_settings.md +++ b/examples/tutorial_derive/02_app_settings.md @@ -5,13 +5,13 @@ 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 + --two + + --one + + -h, --help + Print help information + -V, --version + Print version information ``` diff --git a/examples/tutorial_derive/02_apps.md b/examples/tutorial_derive/02_apps.md index 52c7cc78fb8..373d6a5a93f 100644 --- a/examples/tutorial_derive/02_apps.md +++ b/examples/tutorial_derive/02_apps.md @@ -5,10 +5,10 @@ Does awesome things Usage: 02_apps_derive[EXE] --two --one Options: - --two - --one - -h, --help Print help information - -V, --version Print version information + --two + --one + -h, --help Print help information + -V, --version Print version information $ 02_apps_derive --version MyApp 1.0 diff --git a/examples/tutorial_derive/02_crate.md b/examples/tutorial_derive/02_crate.md index 83848f5e11f..001ccad061f 100644 --- a/examples/tutorial_derive/02_crate.md +++ b/examples/tutorial_derive/02_crate.md @@ -5,10 +5,10 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 02_crate_derive[EXE] --two --one Options: - --two - --one - -h, --help Print help information - -V, --version Print version information + --two + --one + -h, --help Print help information + -V, --version Print version information $ 02_crate_derive --version clap [..] diff --git a/examples/tutorial_derive/03_01_flag_bool.md b/examples/tutorial_derive/03_01_flag_bool.md index a712a0f5b34..b5bfe58d811 100644 --- a/examples/tutorial_derive/03_01_flag_bool.md +++ b/examples/tutorial_derive/03_01_flag_bool.md @@ -5,9 +5,9 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_01_flag_bool_derive[EXE] [OPTIONS] Options: - -v, --verbose - -h, --help Print help information - -V, --version Print version information + -v, --verbose + -h, --help Print help information + -V, --version Print version information $ 03_01_flag_bool_derive verbose: false diff --git a/examples/tutorial_derive/03_01_flag_count.md b/examples/tutorial_derive/03_01_flag_count.md index f16ec3328bb..53834ee2259 100644 --- a/examples/tutorial_derive/03_01_flag_count.md +++ b/examples/tutorial_derive/03_01_flag_count.md @@ -5,9 +5,9 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_01_flag_count_derive[EXE] [OPTIONS] Options: - -v, --verbose... - -h, --help Print help information - -V, --version Print version information + -v, --verbose... + -h, --help Print help information + -V, --version Print version information $ 03_01_flag_count_derive verbose: 0 diff --git a/examples/tutorial_derive/03_02_option.md b/examples/tutorial_derive/03_02_option.md index ca692cd6a81..d1acf395f81 100644 --- a/examples/tutorial_derive/03_02_option.md +++ b/examples/tutorial_derive/03_02_option.md @@ -5,9 +5,9 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_02_option_derive[EXE] [OPTIONS] Options: - -n, --name - -h, --help Print help information - -V, --version Print version information + -n, --name + -h, --help Print help information + -V, --version Print version information $ 03_02_option_derive name: None diff --git a/examples/tutorial_derive/03_02_option_mult.md b/examples/tutorial_derive/03_02_option_mult.md index 54a851a8935..b1969e75385 100644 --- a/examples/tutorial_derive/03_02_option_mult.md +++ b/examples/tutorial_derive/03_02_option_mult.md @@ -5,9 +5,9 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_02_option_mult_derive[EXE] [OPTIONS] Options: - -n, --name - -h, --help Print help information - -V, --version Print version information + -n, --name + -h, --help Print help information + -V, --version Print version information $ 03_02_option_mult_derive name: [] diff --git a/examples/tutorial_derive/03_03_positional.md b/examples/tutorial_derive/03_03_positional.md index 40c290499cc..6ca99ae97bd 100644 --- a/examples/tutorial_derive/03_03_positional.md +++ b/examples/tutorial_derive/03_03_positional.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_03_positional_derive[EXE] [NAME] Arguments: - [NAME] + [NAME] Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 03_03_positional_derive name: None diff --git a/examples/tutorial_derive/03_03_positional_mult.md b/examples/tutorial_derive/03_03_positional_mult.md index 389eeb0f2bd..395d1747267 100644 --- a/examples/tutorial_derive/03_03_positional_mult.md +++ b/examples/tutorial_derive/03_03_positional_mult.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_03_positional_mult_derive[EXE] [NAME]... Arguments: - [NAME]... + [NAME]... Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 03_03_positional_mult_derive name: [] diff --git a/examples/tutorial_derive/03_04_subcommands.md b/examples/tutorial_derive/03_04_subcommands.md index ca937c9fc2b..3e95a680cb4 100644 --- a/examples/tutorial_derive/03_04_subcommands.md +++ b/examples/tutorial_derive/03_04_subcommands.md @@ -5,12 +5,12 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_04_subcommands_derive[EXE] Commands: - add Adds files to myapp - help Print this message or the help of the given subcommand(s) + add Adds files to myapp + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 03_04_subcommands_derive help add Adds files to myapp @@ -18,11 +18,11 @@ Adds files to myapp Usage: 03_04_subcommands_derive[EXE] add [NAME] Arguments: - [NAME] + [NAME] Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 03_04_subcommands_derive add bob 'myapp add' was used, name is: Some("bob") @@ -38,12 +38,12 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_04_subcommands_derive[EXE] Commands: - add Adds files to myapp - help Print this message or the help of the given subcommand(s) + add Adds files to myapp + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information ``` diff --git a/examples/tutorial_derive/03_05_default_values.md b/examples/tutorial_derive/03_05_default_values.md index 1f8de815bc0..9c124b67f68 100644 --- a/examples/tutorial_derive/03_05_default_values.md +++ b/examples/tutorial_derive/03_05_default_values.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 03_05_default_values_derive[EXE] [NAME] Arguments: - [NAME] [default: alice] + [NAME] [default: alice] Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 03_05_default_values_derive name: "alice" diff --git a/examples/tutorial_derive/04_01_enum.md b/examples/tutorial_derive/04_01_enum.md index 6b334efea2e..d23f9bbd32d 100644 --- a/examples/tutorial_derive/04_01_enum.md +++ b/examples/tutorial_derive/04_01_enum.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 04_01_enum_derive[EXE] Arguments: - What mode to run the program in [possible values: fast, slow] + What mode to run the program in [possible values: fast, slow] Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 04_01_enum_derive fast Hare @@ -20,7 +20,7 @@ Tortoise $ 04_01_enum_derive medium ? failed error: "medium" isn't a valid value for '' - [possible values: fast, slow] + [possible values: fast, slow] For more information try --help diff --git a/examples/tutorial_derive/04_02_parse.md b/examples/tutorial_derive/04_02_parse.md index bb659d82033..39d960f263c 100644 --- a/examples/tutorial_derive/04_02_parse.md +++ b/examples/tutorial_derive/04_02_parse.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 04_02_parse_derive[EXE] Arguments: - Network port to use + Network port to use Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 04_02_parse_derive 22 PORT = 22 diff --git a/examples/tutorial_derive/04_02_validate.md b/examples/tutorial_derive/04_02_validate.md index 92f5fd1a0bb..02fec4dfa43 100644 --- a/examples/tutorial_derive/04_02_validate.md +++ b/examples/tutorial_derive/04_02_validate.md @@ -5,11 +5,11 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 04_02_validate_derive[EXE] Arguments: - Network port to use + Network port to use Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information $ 04_02_validate_derive 22 PORT = 22 diff --git a/examples/tutorial_derive/04_03_relations.md b/examples/tutorial_derive/04_03_relations.md index 7ce0a5ce460..17fa8a4854f 100644 --- a/examples/tutorial_derive/04_03_relations.md +++ b/examples/tutorial_derive/04_03_relations.md @@ -5,22 +5,22 @@ 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] Arguments: - [INPUT_FILE] some regular input + [INPUT_FILE] some regular input Options: - --set-ver set version manually - --major auto inc major - --minor auto inc minor - --patch auto inc patch - --spec-in some special input argument - -c - -h, --help Print help information - -V, --version Print version information + --set-ver set version manually + --major auto inc major + --minor auto inc minor + --patch auto inc patch + --spec-in some special input argument + -c + -h, --help Print help information + -V, --version Print version information $ 04_03_relations_derive ? failed error: The following required arguments were not provided: - <--set-ver |--major|--minor|--patch> + <--set-ver |--major|--minor|--patch> Usage: 04_03_relations_derive[EXE] <--set-ver |--major|--minor|--patch> [INPUT_FILE] @@ -40,7 +40,7 @@ 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> > diff --git a/examples/tutorial_derive/04_04_custom.md b/examples/tutorial_derive/04_04_custom.md index e6f7fc28eed..e2e0d3b3ca2 100644 --- a/examples/tutorial_derive/04_04_custom.md +++ b/examples/tutorial_derive/04_04_custom.md @@ -5,17 +5,17 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: 04_04_custom_derive[EXE] [OPTIONS] [INPUT_FILE] Arguments: - [INPUT_FILE] some regular input + [INPUT_FILE] some regular input Options: - --set-ver set version manually - --major auto inc major - --minor auto inc minor - --patch auto inc patch - --spec-in some special input argument - -c - -h, --help Print help information - -V, --version Print version information + --set-ver set version manually + --major auto inc major + --minor auto inc minor + --patch auto inc patch + --spec-in some special input argument + -c + -h, --help Print help information + -V, --version Print version information $ 04_04_custom_derive ? failed diff --git a/examples/typed-derive.md b/examples/typed-derive.md index 32429feb4ff..cf20f77267d 100644 --- a/examples/typed-derive.md +++ b/examples/typed-derive.md @@ -6,12 +6,12 @@ $ typed-derive --help Usage: typed-derive[EXE] [OPTIONS] Options: - -O Implicitly using `std::str::FromStr` - -I Allow invalid UTF-8 paths - --bind Handle IP addresses - --sleep Allow human-readable durations - -D Hand-written parser for tuples - -h, --help Print help information + -O Implicitly using `std::str::FromStr` + -I Allow invalid UTF-8 paths + --bind Handle IP addresses + --sleep Allow human-readable durations + -D Hand-written parser for tuples + -h, --help Print help information ``` diff --git a/src/output/mod.rs b/src/output/mod.rs index 15ea4fe2ce1..cf262bbe7cd 100644 --- a/src/output/mod.rs +++ b/src/output/mod.rs @@ -9,5 +9,5 @@ pub(crate) use self::textwrap::core::display_width; pub(crate) use self::textwrap::wrap; pub(crate) use self::usage::Usage; -pub(crate) const TAB: &str = " "; +pub(crate) const TAB: &str = " "; pub(crate) const TAB_WIDTH: usize = TAB.len(); diff --git a/tests/builder/app_settings.rs b/tests/builder/app_settings.rs index 845eab2f736..6b4ba9a8cfd 100644 --- a/tests/builder/app_settings.rs +++ b/tests/builder/app_settings.rs @@ -8,21 +8,21 @@ static ALLOW_EXT_SC: &str = "\ Usage: clap-test [COMMAND] Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information "; static DONT_COLLAPSE_ARGS: &str = "\ Usage: clap-test [arg1] [arg2] [arg3] Arguments: - [arg1] some - [arg2] some - [arg3] some + [arg1] some + [arg2] some + [arg3] some Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information "; #[test] @@ -125,9 +125,9 @@ fn arg_required_else_help_error_message() { Usage: test [OPTIONS] Options: - -i, --info Provides more info - -h, --help Print help information - -V, --version Print version information + -i, --info Provides more info + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("test") @@ -284,12 +284,12 @@ tests stuff Usage: test [OPTIONS] [arg1] Arguments: - [arg1] some pos arg + [arg1] some pos arg Options: - -o, --opt some option - -h, --help Print help information - -V, --version Print version information + -o, --opt some option + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("test") @@ -624,9 +624,9 @@ fn require_eq() { Usage: clap-test --opt= Options: - -o, --opt= some - -h, --help Print help information - -V, --version Print version information + -o, --opt= some + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("clap-test").version("v1.4.8").arg( diff --git a/tests/builder/arg_aliases.rs b/tests/builder/arg_aliases.rs index 2e8ac655035..062a9bf5154 100644 --- a/tests/builder/arg_aliases.rs +++ b/tests/builder/arg_aliases.rs @@ -196,10 +196,10 @@ Some help Usage: ct test [OPTIONS] Options: - -o, --opt - -f, --flag - -h, --help Print help information - -V, --version Print version information + -o, --opt + -f, --flag + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("ct").author("Salim Afiune").subcommand( @@ -226,10 +226,10 @@ Some help Usage: ct test [OPTIONS] Options: - -o, --opt [aliases: visible] - -f, --flag [aliases: v_flg, flag2, flg3] - -h, --help Print help information - -V, --version Print version information + -o, --opt [aliases: visible] + -f, --flag [aliases: v_flg, flag2, flg3] + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("ct").author("Salim Afiune").subcommand( diff --git a/tests/builder/arg_aliases_short.rs b/tests/builder/arg_aliases_short.rs index c353e3152cb..9e8ea3eacf5 100644 --- a/tests/builder/arg_aliases_short.rs +++ b/tests/builder/arg_aliases_short.rs @@ -163,10 +163,10 @@ Some help Usage: ct test [OPTIONS] Options: - -o, --opt - -f, --flag - -h, --help Print help information - -V, --version Print version information + -o, --opt + -f, --flag + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("ct").author("Salim Afiune").subcommand( @@ -193,10 +193,10 @@ Some help Usage: ct test [OPTIONS] Options: - -o, --opt [short aliases: v] - -f, --flag [aliases: flag1] [short aliases: a, b, 🦆] - -h, --help Print help information - -V, --version Print version information + -o, --opt [short aliases: v] + -f, --flag [aliases: flag1] [short aliases: a, b, 🦆] + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("ct").author("Salim Afiune").subcommand( diff --git a/tests/builder/cargo.rs b/tests/builder/cargo.rs index ead49f6de56..376bda7451c 100644 --- a/tests/builder/cargo.rs +++ b/tests/builder/cargo.rs @@ -12,8 +12,8 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: prog Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information "; static AUTHORS_ONLY: &str = "prog 1 @@ -22,8 +22,8 @@ static AUTHORS_ONLY: &str = "prog 1 Usage: prog Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information "; #[test] diff --git a/tests/builder/command.rs b/tests/builder/command.rs index 8fa413567ce..8c2c197c7ba 100644 --- a/tests/builder/command.rs +++ b/tests/builder/command.rs @@ -10,8 +10,8 @@ A simple to use, efficient, and full-featured Command Line Argument Parser Usage: clap Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information "; #[test] diff --git a/tests/builder/conflicts.rs b/tests/builder/conflicts.rs index f98d1fc215b..50ed63e880a 100644 --- a/tests/builder/conflicts.rs +++ b/tests/builder/conflicts.rs @@ -290,7 +290,8 @@ fn get_arg_conflicts_with_group() { #[test] fn conflict_output() { - static CONFLICT_ERR: &str = "error: The argument '--flag...' cannot be used with '-F' + static CONFLICT_ERR: &str = "\ +error: The argument '--flag...' cannot be used with '-F' Usage: clap-test --flag... --long-option-2 [positional3]... @@ -307,7 +308,8 @@ For more information try --help #[test] fn conflict_output_rev() { - static CONFLICT_ERR_REV: &str = "error: The argument '-F' cannot be used with '--flag...' + static CONFLICT_ERR_REV: &str = "\ +error: The argument '-F' cannot be used with '--flag...' Usage: clap-test -F --long-option-2 [positional3]... @@ -324,7 +326,8 @@ For more information try --help #[test] fn conflict_output_with_required() { - static CONFLICT_ERR: &str = "error: The argument '--flag...' cannot be used with '-F' + static CONFLICT_ERR: &str = "\ +error: The argument '--flag...' cannot be used with '-F' Usage: clap-test --flag... --long-option-2 [positional3]... @@ -341,7 +344,8 @@ For more information try --help #[test] fn conflict_output_rev_with_required() { - static CONFLICT_ERR_REV: &str = "error: The argument '-F' cannot be used with '--flag...' + static CONFLICT_ERR_REV: &str = "\ +error: The argument '-F' cannot be used with '--flag...' Usage: clap-test -F --long-option-2 [positional3]... @@ -358,9 +362,10 @@ For more information try --help #[test] fn conflict_output_three_conflicting() { - static CONFLICT_ERR_THREE: &str = "error: The argument '--one' cannot be used with: - --two - --three + static CONFLICT_ERR_THREE: &str = "\ +error: The argument '--one' cannot be used with: + --two + --three Usage: three_conflicting_arguments --one diff --git a/tests/builder/default_vals.rs b/tests/builder/default_vals.rs index b62492c183f..05fc34c3851 100644 --- a/tests/builder/default_vals.rs +++ b/tests/builder/default_vals.rs @@ -728,8 +728,9 @@ fn default_vals_donnot_show_in_smart_usage() { utils::assert_output( cmd, "bug", - "error: The following required arguments were not provided: - + "\ +error: The following required arguments were not provided: + Usage: bug diff --git a/tests/builder/derive_order.rs b/tests/builder/derive_order.rs index 5f926efef37..07de2757414 100644 --- a/tests/builder/derive_order.rs +++ b/tests/builder/derive_order.rs @@ -10,12 +10,12 @@ fn no_derive_order() { Usage: test [OPTIONS] Options: - --flag_a second flag - --flag_b first flag - -h, --help Print help information - --option_a second option - --option_b first option - -V, --version Print version information + --flag_a second flag + --flag_b first flag + -h, --help Print help information + --option_a second option + --option_b first option + -V, --version Print version information "; let cmd = Command::new("test") @@ -49,12 +49,12 @@ fn derive_order() { Usage: test [OPTIONS] Options: - --flag_b first flag - --option_b first option - --flag_a second flag - --option_a second option - -h, --help Print help information - -V, --version Print version information + --flag_b first flag + --option_b first option + --flag_a second flag + --option_a second option + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("test").version("1.2").args(&[ @@ -85,12 +85,12 @@ fn derive_order_next_order() { Usage: test [OPTIONS] Options: - --flag_b first flag - --option_b first option - -h, --help Print help information - -V, --version Print version information - --flag_a second flag - --option_a second option + --flag_b first flag + --option_b first option + -h, --help Print help information + -V, --version Print version information + --flag_a second flag + --option_a second option "; let cmd = Command::new("test") @@ -131,12 +131,12 @@ fn derive_order_no_next_order() { Usage: test [OPTIONS] Options: - --flag_a first flag - --flag_b second flag - -h, --help Print help information - --option_a first option - --option_b second option - -V, --version Print version information + --flag_a first flag + --flag_b second flag + -h, --help Print help information + --option_a first option + --option_b second option + -V, --version Print version information "; let cmd = Command::new("test") @@ -176,12 +176,12 @@ fn derive_order_subcommand_propagate() { Usage: test sub [OPTIONS] Options: - --flag_b first flag - --option_b first option - --flag_a second flag - --option_a second option - -h, --help Print help information - -V, --version Print version information + --flag_b first flag + --option_b first option + --flag_a second flag + --option_a second option + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("test").subcommand( @@ -214,12 +214,12 @@ fn derive_order_subcommand_propagate_with_explicit_display_order() { Usage: test sub [OPTIONS] Options: - --flag_a second flag - --flag_b first flag - --option_b first option - --option_a second option - -h, --help Print help information - -V, --version Print version information + --flag_a second flag + --flag_b first flag + --option_b first option + --option_a second option + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("test").subcommand( @@ -258,13 +258,13 @@ fn subcommand_sorted_display_order() { Usage: test [COMMAND] Commands: - a1 blah a1 - b1 blah b1 - help Print this message or the help of the given subcommand(s) + a1 blah a1 + b1 blah b1 + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information "; let app_subcmd_alpha_order = Command::new("test") @@ -293,13 +293,13 @@ fn subcommand_derived_display_order() { Usage: test [COMMAND] Commands: - b1 blah b1 - a1 blah a1 - help Print this message or the help of the given subcommand(s) + b1 blah b1 + a1 blah a1 + help Print this message or the help of the given subcommand(s) Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information "; let app_subcmd_decl_order = Command::new("test").version("1").subcommands(vec![ diff --git a/tests/builder/display_order.rs b/tests/builder/display_order.rs index 077b243ba3b..763734a40a1 100644 --- a/tests/builder/display_order.rs +++ b/tests/builder/display_order.rs @@ -13,11 +13,11 @@ fn very_large_display_order() { Usage: test [COMMAND] Commands: - help Print this message or the help of the given subcommand(s) - sub + help Print this message or the help of the given subcommand(s) + sub Options: - -h, --help Print help information + -h, --help Print help information ", false, ); diff --git a/tests/builder/double_require.rs b/tests/builder/double_require.rs index 6200fc8e425..1a83d1b9d58 100644 --- a/tests/builder/double_require.rs +++ b/tests/builder/double_require.rs @@ -4,22 +4,24 @@ static HELP: &str = "\ Usage: prog [OPTIONS] Options: - -a - -b - -c - -h, --help Print help information + -a + -b + -c + -h, --help Print help information "; -static ONLY_B_ERROR: &str = "error: The following required arguments were not provided: - -c +static ONLY_B_ERROR: &str = "\ +error: The following required arguments were not provided: + -c Usage: prog -b -c For more information try --help "; -static ONLY_C_ERROR: &str = "error: The following required arguments were not provided: - -b +static ONLY_C_ERROR: &str = "\ +error: The following required arguments were not provided: + -b Usage: prog -c -b diff --git a/tests/builder/error.rs b/tests/builder/error.rs index 26344039bb1..611cf4d654b 100644 --- a/tests/builder/error.rs +++ b/tests/builder/error.rs @@ -91,7 +91,7 @@ fn null_prints_help() { Usage: test Options: - -h, --help Print help information + -h, --help Print help information "; assert_error(err, expected_kind, MESSAGE, false); } @@ -109,7 +109,7 @@ fn raw_prints_help() { Usage: test Options: - -h, --help Print help information + -h, --help Print help information "; assert_error(err, expected_kind, MESSAGE, false); } diff --git a/tests/builder/flag_subcommands.rs b/tests/builder/flag_subcommands.rs index e55afe08b12..627431b31e0 100644 --- a/tests/builder/flag_subcommands.rs +++ b/tests/builder/flag_subcommands.rs @@ -502,9 +502,9 @@ Query the package database. Usage: pacman {query|--query|-Q} [OPTIONS] Options: - -s, --search ... search locally installed packages for matching strings - -i, --info ... view package information - -h, --help Print help information + -s, --search ... search locally installed packages for matching strings + -i, --info ... view package information + -h, --help Print help information "; #[test] @@ -550,9 +550,9 @@ Query the package database. Usage: pacman {query|--query} [OPTIONS] Options: - -s, --search ... search locally installed packages for matching strings - -i, --info ... view package information - -h, --help Print help information + -s, --search ... search locally installed packages for matching strings + -i, --info ... view package information + -h, --help Print help information "; #[test] @@ -602,9 +602,9 @@ Query the package database. Usage: pacman {query|-Q} [OPTIONS] Options: - -s, --search ... search locally installed packages for matching strings - -i, --info ... view package information - -h, --help Print help information + -s, --search ... search locally installed packages for matching strings + -i, --info ... view package information + -h, --help Print help information "; #[test] diff --git a/tests/builder/flags.rs b/tests/builder/flags.rs index 699d33e966d..c0afc4ee595 100644 --- a/tests/builder/flags.rs +++ b/tests/builder/flags.rs @@ -1,10 +1,10 @@ use super::utils; use clap::{arg, Arg, ArgAction, Command}; -const USE_FLAG_AS_ARGUMENT: &str = - "error: Found argument '--another-flag' which wasn't expected, or isn't valid in this context +const USE_FLAG_AS_ARGUMENT: &str = "\ +error: Found argument '--another-flag' which wasn't expected, or isn't valid in this context - If you tried to supply `--another-flag` as a value rather than a flag, use `-- --another-flag` + If you tried to supply `--another-flag` as a value rather than a flag, use `-- --another-flag` Usage: mycat [OPTIONS] [filename] @@ -177,10 +177,10 @@ fn issue_1284_argument_in_flag_style() { #[test] fn issue_2308_multiple_dashes() { - static MULTIPLE_DASHES: &str = - "error: Found argument '-----' which wasn't expected, or isn't valid in this context + static MULTIPLE_DASHES: &str = "\ +error: Found argument '-----' which wasn't expected, or isn't valid in this context - If you tried to supply `-----` as a value rather than a flag, use `-- -----` + If you tried to supply `-----` as a value rather than a flag, use `-- -----` Usage: test diff --git a/tests/builder/groups.rs b/tests/builder/groups.rs index 1a62c6af009..93281ca7712 100644 --- a/tests/builder/groups.rs +++ b/tests/builder/groups.rs @@ -3,23 +3,23 @@ use super::utils; use clap::{arg, error::ErrorKind, Arg, ArgAction, ArgGroup, Command, Id}; static REQ_GROUP_USAGE: &str = "error: The following required arguments were not provided: - + Usage: clap-test For more information try --help "; -static REQ_GROUP_CONFLICT_USAGE: &str = - "error: The argument '--delete' cannot be used with '[base]' +static REQ_GROUP_CONFLICT_USAGE: &str = "\ +error: The argument '--delete' cannot be used with '[base]' Usage: clap-test For more information try --help "; -static REQ_GROUP_CONFLICT_ONLY_OPTIONS: &str = - "error: The argument '--delete' cannot be used with '--all' +static REQ_GROUP_CONFLICT_ONLY_OPTIONS: &str = "\ +error: The argument '--delete' cannot be used with '--all' Usage: clap-test <--all|--delete> @@ -262,10 +262,10 @@ fn group_usage_use_val_name() { Usage: prog Arguments: - [A] + [A] Options: - -h, --help Print help information + -h, --help Print help information "; let cmd = Command::new("prog") .arg(Arg::new("a").value_name("A")) diff --git a/tests/builder/help.rs b/tests/builder/help.rs index be3f6531794..961eedc5433 100644 --- a/tests/builder/help.rs +++ b/tests/builder/help.rs @@ -91,12 +91,12 @@ fn req_last_arg_usage() { Usage: example ... -- ... Arguments: - ... First - ... Second + ... First + ... Second Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("example") @@ -118,15 +118,15 @@ fn args_with_last_usage() { Usage: flamegraph [OPTIONS] [BINFILE] [-- ...] Arguments: - [BINFILE] The path of the binary to be profiled. for a binary. - [ARGS]... Any arguments you wish to pass to the being profiled. + [BINFILE] The path of the binary to be profiled. for a binary. + [ARGS]... Any arguments you wish to pass to the being profiled. Options: - -v, --verbose Prints out more stuff. - -t, --timeout Timeout in seconds. - -f, --frequency The sampling frequency. - -h, --help Print help information - -V, --version Print version information + -v, --verbose Prints out more stuff. + -t, --timeout Timeout in seconds. + -f, --frequency The sampling frequency. + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("flamegraph") @@ -202,28 +202,28 @@ tests clap library Usage: clap-test [OPTIONS] [positional] [positional2] [positional3]... [COMMAND] Commands: - subcmd tests subcommands - help Print this message or the help of the given subcommand(s) + subcmd tests subcommands + help Print this message or the help of the given subcommand(s) Arguments: - [positional] tests positionals - [positional2] tests positionals with exclusions - [positional3]... tests specific values [possible values: vi, emacs] - -Options: - -o, --option ... tests options - -f, --flag... tests flags - -F tests flags with exclusions - --long-option-2 tests long options with exclusions - -O, --option3 specific vals [possible values: fast, slow] - --multvals Tests multiple values, not mult occs - --multvalsmo Tests multiple values, and mult occs - --minvals2 ... Tests 2 min vals - --maxvals3 ... Tests 3 max vals - --optvaleq[=] Tests optional value, require = sign - --optvalnoeq [] Tests optional value - -h, --help Print help information - -V, --version Print version information + [positional] tests positionals + [positional2] tests positionals with exclusions + [positional3]... tests specific values [possible values: vi, emacs] + +Options: + -o, --option ... tests options + -f, --flag... tests flags + -F tests flags with exclusions + --long-option-2 tests long options with exclusions + -O, --option3 specific vals [possible values: fast, slow] + --multvals Tests multiple values, not mult occs + --multvalsmo Tests multiple values, and mult occs + --minvals2 ... Tests 2 min vals + --maxvals3 ... Tests 3 max vals + --optvaleq[=] Tests optional value, require = sign + --optvalnoeq [] Tests optional value + -h, --help Print help information + -V, --version Print version information "; utils::assert_output(utils::complex_app(), "clap-test --help", HELP, false); @@ -238,8 +238,8 @@ tests clap library Usage: clap-test Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information some text that comes after the help "; @@ -262,8 +262,8 @@ tests clap library Usage: clap-test Options: - -h, --help Print help information (use `--help` for more detail) - -V, --version Print version information + -h, --help Print help information (use `--help` for more detail) + -V, --version Print version information some text that comes after the help "; @@ -275,11 +275,11 @@ tests clap library Usage: clap-test Options: - -h, --help - Print help information (use `-h` for a summary) + -h, --help + Print help information (use `-h` for a summary) - -V, --version - Print version information + -V, --version + Print version information some longer text that comes after the help "; @@ -301,10 +301,10 @@ tests subcommands Usage: ctest subcmd multi [OPTIONS] Options: - -f, --flag tests flags - -o, --option ... tests options - -h, --help Print help information - -V, --version Print version information + -f, --flag tests flags + -o, --option ... tests options + -h, --help Print help information + -V, --version Print version information "; #[test] @@ -337,8 +337,8 @@ fn no_wrap_default_help() { Usage: ctest Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("ctest").version("1.0").term_width(0); @@ -352,18 +352,17 @@ fn wrapped_help() { Usage: test [OPTIONS] Options: - -a, --all - Also do versioning for private crates (will not be - published) - --exact - Specify inter dependency version numbers exactly with - `=` - --no-git-commit - Do not commit version changes - --no-git-push - Do not push generated commit and tags to git remote - -h, --help - Print help information + -a, --all + Also do versioning for private crates (will not be + published) + --exact + Specify inter dependency version numbers exactly with `=` + --no-git-commit + Do not commit version changes + --no-git-push + Do not push generated commit and tags to git remote + -h, --help + Print help information "; let cmd = Command::new("test") .term_width(67) @@ -402,14 +401,14 @@ fn unwrapped_help() { Usage: test [OPTIONS] Options: - -a, --all Also do versioning for private crates - (will not be published) - --exact Specify inter dependency version numbers - exactly with `=` - --no-git-commit Do not commit version changes - --no-git-push Do not push generated commit and tags to - git remote - -h, --help Print help information + -a, --all Also do versioning for private crates (will + not be published) + --exact Specify inter dependency version numbers + exactly with `=` + --no-git-commit Do not commit version changes + --no-git-push Do not push generated commit and tags to git + remote + -h, --help Print help information "; let cmd = Command::new("test") .term_width(68) @@ -448,27 +447,27 @@ fn possible_value_wrapped_help() { Usage: test [OPTIONS] Options: - --possible-values - Possible values: - - short_name: - Long enough help message, barely warrant wrapping - - second: - Short help gets handled the same + --possible-values + Possible values: + - short_name: + Long enough help message, barely warrant wrapping + - second: + Short help gets handled the same - --possible-values-with-new-line - Possible values: - - long enough name to trigger new line: - Really long enough help message to clearly warrant - wrapping believe me - - second + --possible-values-with-new-line + Possible values: + - long enough name to trigger new line: + Really long enough help message to clearly warrant + wrapping believe me + - second - --possible-values-without-new-line - Possible values: - - name: Short enough help message with no wrapping - - second: short help + --possible-values-without-new-line + Possible values: + - name: Short enough help message with no wrapping + - second: short help - -h, --help - Print help information (use `-h` for a summary) + -h, --help + Print help information (use `-h` for a summary) "; let cmd = Command::new("test") .term_width(67) @@ -514,14 +513,14 @@ tests subcommands Usage: clap-test subcmd [OPTIONS] [scpositional] Arguments: - [scpositional] tests positionals + [scpositional] tests positionals Options: - -o, --option ... tests options - -f, --flag... tests flags - -s, --subcmdarg tests other args - -h, --help Print help information - -V, --version Print version information + -o, --option ... tests options + -f, --flag... tests flags + -s, --subcmdarg tests other args + -h, --help Print help information + -V, --version Print version information "; let a = utils::complex_app(); @@ -534,16 +533,16 @@ fn issue_626_unicode_cutoff() { Usage: ctest [OPTIONS] Options: - -c, --cafe A coffeehouse, coffee shop, or café is an - establishment which primarily serves hot - coffee, related coffee beverages (e.g., café - latte, cappuccino, espresso), tea, and other - 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. - -h, --help Print help information - -V, --version Print version information + -c, --cafe A coffeehouse, coffee shop, or café is an + establishment which primarily serves hot coffee, + related coffee beverages (e.g., café latte, + cappuccino, espresso), tea, and other 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. + -h, --help Print help information + -V, --version Print version information "; let cmd = Command::new("ctest").version("0.1").term_width(70).arg( @@ -553,11 +552,11 @@ Options: .value_name("FILE") .help( "A coffeehouse, coffee shop, or café is an establishment \ - which primarily serves hot coffee, related coffee beverages \ - (e.g., café latte, cappuccino, espresso), tea, and other 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.", + which primarily serves hot coffee, related coffee beverages \ + (e.g., café latte, cappuccino, espresso), tea, and other 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.", ) .action(ArgAction::Set), ); @@ -568,10 +567,10 @@ static HIDE_POS_VALS: &str = "\ Usage: ctest [OPTIONS] Options: - -p, --pos Some vals [possible values: fast, slow] - -c, --cafe A coffeehouse, coffee shop, or café. - -h, --help Print help information - -V, --version Print version information + -p, --pos Some vals [possible values: fast, slow] + -c, --cafe A coffeehouse, coffee shop, or café. + -h, --help Print help information + -V, --version Print version information "; #[test] @@ -634,21 +633,21 @@ fn possible_vals_with_help() { Usage: ctest [OPTIONS] Options: - -p, --pos - Some vals + -p, --pos + Some vals - Possible values: - - fast - - slow: not as fast + Possible values: + - fast + - slow: not as fast - -c, --cafe - A coffeehouse, coffee shop, or café. + -c, --cafe + A coffeehouse, coffee shop, or café. - -h, --help - Print help information (use `-h` for a summary) + -h, --help + Print help information (use `-h` for a summary) - -V, --version - Print version information + -V, --version + Print version information "; let app = Command::new("ctest") .version("0.1") @@ -682,18 +681,18 @@ fn issue_626_panic() { Usage: ctest [OPTIONS] Options: - -c, --cafe - La culture du café est très développée - dans de nombreux pays à climat chaud - d\'Amérique, d\'Afrique et d\'Asie, dans - 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. - -h, --help - Print help information - -V, --version - Print version information + -c, --cafe + La culture du café est très développée + dans de nombreux pays à climat chaud + d\'Amérique, d\'Afrique et d\'Asie, dans 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. + -h, --help + Print help information + -V, --version + Print version information "; let cmd = Command::new("ctest") @@ -734,13 +733,12 @@ fn final_word_wrapping() { Usage: ctest Options: - -h, --help - Print help - information - -V, --version - Print - version - information + -h, --help + Print help + information + -V, --version + Print version + information "; let cmd = Command::new("ctest").version("0.1").term_width(24); @@ -751,16 +749,15 @@ static WRAPPING_NEWLINE_CHARS: &str = "\ Usage: ctest [mode] Arguments: - [mode] x, max, maximum 20 characters, contains - symbols. - l, long Copy-friendly, 14 - characters, contains symbols. - m, med, medium Copy-friendly, 8 characters, - contains symbols. + [mode] x, max, maximum 20 characters, contains symbols. + l, long Copy-friendly, 14 characters, + contains symbols. + m, med, medium Copy-friendly, 8 characters, + contains symbols. Options: - -h, --help Print help information - -V, --version Print version information + -h, --help Print help information + -V, --version Print version information "; #[test] @@ -804,14 +801,14 @@ fn dont_wrap_urls() { Usage: Example update [OPTIONS] Options: - --force-non-host - Install toolchains - that require an - emulator. See - https://github.com/rust-lang/rustup/wiki/Non-host-toolchains - -h, --help - Print help - information + --force-non-host + Install toolchains + that require an + emulator. See + https://github.com/rust-lang/rustup/wiki/Non-host-toolchains + -h, --help + Print help + information "; utils::assert_output(cmd, "Example update --help", EXPECTED, false); } @@ -820,10 +817,10 @@ static OLD_NEWLINE_CHARS: &str = "\ Usage: ctest [OPTIONS] Options: - -m Some help with some wrapping - (Defaults to something) - -h, --help Print help information - -V, --version Print version information + -m Some help with some wrapping + (Defaults to something) + -h, --help Print help information + -V, --version Print version information "; #[test] @@ -854,44 +851,44 @@ fn issue_688_hide_pos_vals() { Usage: ctest [OPTIONS] Options: - --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] - -h, --help Print help information - -V, --version Print version information + --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] + -h, --help Print help information + -V, --version Print version information "; let filter_values = ["Nearest", "Linear", "Cubic", "Gaussian", "Lanczos3"]; let app1 = Command::new("ctest") - .version("0.1") + .version("0.1") .term_width(120) .hide_possible_values(true) .arg(Arg::new("filter") .help("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]") + images. The default is Linear (Bilinear). [possible values: Nearest, Linear, Cubic, Gaussian, Lanczos3]") .long("filter") .value_parser(filter_values) .action(ArgAction::Set)); utils::assert_output(app1, "ctest --help", ISSUE_688, false); let app2 = Command::new("ctest") - .version("0.1") + .version("0.1") .term_width(120) .arg(Arg::new("filter") .help("Sets the filter, or sampling method, to use for interpolation when resizing the particle \ - images. The default is Linear (Bilinear).") + images. The default is Linear (Bilinear).") .long("filter") .value_parser(filter_values) .action(ArgAction::Set)); utils::assert_output(app2, "ctest --help", ISSUE_688, false); let app3 = Command::new("ctest") - .version("0.1") + .version("0.1") .term_width(120) .arg(Arg::new("filter") .help("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]") + images. The default is Linear (Bilinear). [possible values: Nearest, Linear, Cubic, Gaussian, Lanczos3]") .long("filter") .action(ArgAction::Set)); utils::assert_output(app3, "ctest --help", ISSUE_688, false); @@ -905,15 +902,15 @@ bar Usage: myapp [OPTIONS] [arg1] [arg2]... Arguments: - [arg1] some option - [arg2]... some option + [arg1] some option + [arg2]... some option Options: - -s, --some some option - -o, --other some other option - -l, --label