Skip to content

Commit

Permalink
revert(help): Partial revert of 3c049b4
Browse files Browse the repository at this point in the history
The extra whitespace was targeted at machine processing for a subset of
users for a subset of runs of CLIs.  On the other hand, there is a lot
of concern over the extra verbose output.

A user can set the help template for man, if desired.  They can even do
something (env? feature flag?) to make it only run when doing man
generation.  We also have clap-rs#3174 in the works.

So let's focus on the end-user reading `--help`.  People wanting to use
`help2man` have workarounds to do what they need.

Fixes clap-rs#3096
  • Loading branch information
epage committed Dec 15, 2021
1 parent 56ed998 commit 9e64387
Show file tree
Hide file tree
Showing 18 changed files with 3 additions and 102 deletions.
1 change: 0 additions & 1 deletion examples/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Used to validate README.md's content
```bash
$ demo --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down
1 change: 0 additions & 1 deletion examples/derive_ref/custom_bool.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Example of overriding the magic `bool` behavior
```bash
$ custom_bool --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down
1 change: 0 additions & 1 deletion examples/escaped_positional.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Let's see what this looks like in the help:
```bash
$ escaped_positional --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down
1 change: 0 additions & 1 deletion examples/escaped_positional_derive.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Let's see what this looks like in the help:
```bash
$ escaped_positional_derive --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down
4 changes: 0 additions & 4 deletions examples/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Help:
$ git
? failed
git

A fictional versioning CLI

USAGE:
Expand All @@ -23,7 +22,6 @@ SUBCOMMANDS:
push pushes things
$ git help
git

A fictional versioning CLI

USAGE:
Expand All @@ -39,7 +37,6 @@ SUBCOMMANDS:
push pushes things
$ git help add
git[EXE]-add

adds things

USAGE:
Expand All @@ -57,7 +54,6 @@ A basic argument:
$ git add
? failed
git[EXE]-add

adds things

USAGE:
Expand Down
4 changes: 0 additions & 4 deletions examples/git_derive.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Help:
$ git_derive
? failed
git

A fictional versioning CLI

USAGE:
Expand All @@ -25,7 +24,6 @@ SUBCOMMANDS:
push pushes things
$ git_derive help
git

A fictional versioning CLI

USAGE:
Expand All @@ -41,7 +39,6 @@ SUBCOMMANDS:
push pushes things
$ git_derive help add
git_derive[EXE]-add

adds things

USAGE:
Expand All @@ -59,7 +56,6 @@ A basic argument:
$ git_derive add
? failed
git_derive[EXE]-add

adds things

USAGE:
Expand Down
18 changes: 0 additions & 18 deletions examples/tutorial_builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ You can create an application with several arguments using usage strings.
```bash
$ 01_quick --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -66,9 +65,7 @@ You use the `App` the start building a parser.
```bash
$ 02_apps --help
MyApp 1.0

Kevin K. <kbknapp@gmail.com>

Does awesome things

USAGE:
Expand All @@ -90,7 +87,6 @@ file. **This requires the `cargo` feature flag.**
```bash
$ 02_crate --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand All @@ -113,7 +109,6 @@ all subcommands (`app.global_setting()`).
```bash
$ 02_app_settings --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand All @@ -139,7 +134,6 @@ Flags are switches that can be on/off:
```bash
$ 03_01_flag_bool --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -169,7 +163,6 @@ Or counted.
```bash
$ 03_01_flag_count --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand All @@ -195,7 +188,6 @@ Flags can also accept a value.
```bash
$ 03_02_option --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -227,7 +219,6 @@ Or you can have users specify values by their position on the command-line:
```bash
$ 03_03_positional --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -256,7 +247,6 @@ subcommands.
$ 03_04_subcommands
? failed
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand All @@ -271,7 +261,6 @@ SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
$ 03_04_subcommands help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand All @@ -286,7 +275,6 @@ SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
$ 03_04_subcommands help add
03_04_subcommands[EXE]-add [..]

Adds files to myapp

USAGE:
Expand Down Expand Up @@ -320,7 +308,6 @@ set `Arg::default_value`.
```bash
$ 03_05_default_values --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -353,7 +340,6 @@ of the mistake, and what the possible valid values are
```bash
$ 04_01_possible --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -386,7 +372,6 @@ When enabling the `derive` feature, you can use `ArgEnum` to take care of the bo
```bash
$ 04_01_enum --help
clap [..]
A simple to use, efficient, and full-featured Command Line Argument Parser
USAGE:
Expand Down Expand Up @@ -421,7 +406,6 @@ More generally, you can validate and parse into any data type.
```bash
$ 04_02_validate --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -458,7 +442,6 @@ each other.
```bash
$ 04_03_relations --help
clap [..]
A simple to use, efficient, and full-featured Command Line Argument Parser
USAGE:
Expand Down Expand Up @@ -517,7 +500,6 @@ As a last resort, you can create custom errors with the basics of clap's formatt
```bash
$ 04_04_custom --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down
17 changes: 0 additions & 17 deletions examples/tutorial_derive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ attributes. **This requires enabling the `derive` feature flag.**
```bash
$ 01_quick_derive --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -67,9 +66,7 @@ You use the `App` the start building a parser.
```bash
$ 02_apps_derive --help
MyApp 1.0

Kevin K. <kbknapp@gmail.com>

Does awesome things

USAGE:
Expand All @@ -90,7 +87,6 @@ You can use `app_from_crate!()` to fill these fields in from your `Cargo.toml` f
```bash
$ 02_crate_derive --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand All @@ -113,7 +109,6 @@ all subcommands (`app.global_setting()`).
```bash
$ 02_app_settings_derive --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand All @@ -139,7 +134,6 @@ Flags are switches that can be on/off:
```bash
$ 03_01_flag_bool_derive --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -169,7 +163,6 @@ Or counted.
```bash
$ 03_01_flag_count_derive --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand All @@ -195,7 +188,6 @@ Flags can also accept a value.
```bash
$ 03_02_option_derive --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -227,7 +219,6 @@ Or you can have users specify values by their position on the command-line:
```bash
$ 03_03_positional_derive --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -256,7 +247,6 @@ subcommands.
$ 03_04_subcommands_derive
? failed
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand All @@ -271,7 +261,6 @@ SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
$ 03_04_subcommands_derive help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand All @@ -286,7 +275,6 @@ SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
$ 03_04_subcommands_derive help add
03_04_subcommands_derive[EXE]-add [..]

Adds files to myapp

USAGE:
Expand Down Expand Up @@ -320,7 +308,6 @@ set `Arg::default_value`.
```bash
$ 03_05_default_values_derive --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -353,7 +340,6 @@ of the mistake, and what the possible valid values are
```bash
$ 04_01_enum_derive --help
clap [..]

A simple to use, efficient, and full-featured Command Line Argument Parser

USAGE:
Expand Down Expand Up @@ -388,7 +374,6 @@ More generally, you can validate and parse into any data type.
```bash
$ 04_02_validate_derive --help
clap [..]
A simple to use, efficient, and full-featured Command Line Argument Parser
USAGE:
Expand Down Expand Up @@ -425,7 +410,6 @@ each other.
```bash
$ 04_03_relations_derive --help
clap [..]
A simple to use, efficient, and full-featured Command Line Argument Parser
USAGE:
Expand Down Expand Up @@ -484,7 +468,6 @@ As a last resort, you can create custom errors with the basics of clap's formatt
```bash
$ 04_04_custom_derive --help
clap [..]
A simple to use, efficient, and full-featured Command Line Argument Parser
USAGE:
Expand Down
6 changes: 2 additions & 4 deletions src/output/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,15 @@ pub(crate) struct Help<'help, 'app, 'parser, 'writer> {
impl<'help, 'app, 'parser, 'writer> Help<'help, 'app, 'parser, 'writer> {
const DEFAULT_TEMPLATE: &'static str = "\
{before-help}{bin} {version}\n\
{author-section}\
{about-section}\n\
{author-with-newline}{about-with-newline}\n\
{usage-heading}\n {usage}\n\
\n\
{all-args}{after-help}\
";

const DEFAULT_NO_ARGS_TEMPLATE: &'static str = "\
{before-help}{bin} {version}\n\
{author-section}\
{about-section}\n\
{author-with-newline}{about-with-newline}\n\
{usage-heading}\n {usage}{after-help}\
";

Expand Down
1 change: 0 additions & 1 deletion tests/builder/app_from_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use clap::{app_from_crate, ErrorKind};

static EVERYTHING: &str = "clap {{version}}
A simple to use, efficient, and full-featured Command Line Argument Parser
USAGE:
Expand Down
Loading

0 comments on commit 9e64387

Please sign in to comment.