Skip to content

Commit

Permalink
Merge pull request #4192 from epage/tab
Browse files Browse the repository at this point in the history
fix(help): Make output more dense
  • Loading branch information
epage committed Sep 7, 2022
2 parents 65c2897 + c90a4ea commit c95c9f2
Show file tree
Hide file tree
Showing 82 changed files with 1,057 additions and 1,038 deletions.
14 changes: 8 additions & 6 deletions CHANGELOG.md
Expand Up @@ -69,14 +69,14 @@ A fictional versioning CLI
Usage: git <COMMAND>
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
Expand All @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions examples/cargo-example-derive.md
Expand Up @@ -9,21 +9,21 @@ $ cargo-example-derive --help
Usage: cargo <COMMAND>

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

Usage: cargo example-derive [OPTIONS]

Options:
--manifest-path <MANIFEST_PATH>
-h, --help Print help information
-V, --version Print version information
--manifest-path <MANIFEST_PATH>
-h, --help Print help information
-V, --version Print version information

```

Expand Down
12 changes: 6 additions & 6 deletions examples/cargo-example.md
Expand Up @@ -9,21 +9,21 @@ $ cargo-example --help
Usage: cargo <COMMAND>

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

Usage: cargo example [OPTIONS]

Options:
--manifest-path <PATH>
-h, --help Print help information
-V, --version Print version information
--manifest-path <PATH>
-h, --help Print help information
-V, --version Print version information

```

Expand Down
8 changes: 4 additions & 4 deletions examples/demo.md
Expand Up @@ -5,10 +5,10 @@ A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: demo[EXE] [OPTIONS] --name <NAME>

Options:
-n, --name <NAME> Name of the person to greet
-c, --count <COUNT> Number of times to greet [default: 1]
-h, --help Print help information
-V, --version Print version information
-n, --name <NAME> Name of the person to greet
-c, --count <COUNT> Number of times to greet [default: 1]
-h, --help Print help information
-V, --version Print version information

$ demo --name Me
Hello Me!
Expand Down
14 changes: 7 additions & 7 deletions examples/derive_ref/custom-bool.md
Expand Up @@ -9,19 +9,19 @@ A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: custom-bool[EXE] [OPTIONS] --foo <FOO> <BOOM>

Arguments:
<BOOM> [possible values: true, false]
<BOOM> [possible values: true, false]

Options:
--foo <FOO> [possible values: true, false]
--bar <BAR> [default: false]
-h, --help Print help information
-V, --version Print version information
--foo <FOO> [possible values: true, false]
--bar <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>
<BOOM>
--foo <FOO>
<BOOM>

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

Expand Down
18 changes: 9 additions & 9 deletions examples/derive_ref/interop_tests.md
Expand Up @@ -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]

Expand Down Expand Up @@ -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]

Expand All @@ -101,13 +101,13 @@ $ interop_hand_subcommand
Usage: interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>

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

```

Expand Down Expand Up @@ -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]...

Expand Down Expand Up @@ -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]

Expand Down
10 changes: 5 additions & 5 deletions examples/escaped-positional-derive.md
Expand Up @@ -10,13 +10,13 @@ A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: escaped-positional-derive[EXE] [OPTIONS] [-- <SLOP>...]

Arguments:
[SLOP]...
[SLOP]...

Options:
-f
-p <PEAR>
-h, --help Print help information
-V, --version Print version information
-f
-p <PEAR>
-h, --help Print help information
-V, --version Print version information

```

Expand Down
10 changes: 5 additions & 5 deletions examples/escaped-positional.md
Expand Up @@ -10,13 +10,13 @@ A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: escaped-positional[EXE] [OPTIONS] [-- <SLOP>...]

Arguments:
[SLOP]...
[SLOP]...

Options:
-f
-p <PEAR>
-h, --help Print help information
-V, --version Print version information
-f
-p <PEAR>
-h, --help Print help information
-V, --version Print version information

```

Expand Down
14 changes: 7 additions & 7 deletions examples/find.md
Expand Up @@ -7,17 +7,17 @@ A simple to use, efficient, and full-featured Command Line Argument Parser
Usage: find[EXE] [OPTIONS] --name <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 <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 <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
[
Expand Down
64 changes: 32 additions & 32 deletions examples/git-derive.md
Expand Up @@ -11,42 +11,42 @@ A fictional versioning CLI
Usage: git-derive[EXE] <COMMAND>

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

Usage: git-derive[EXE] <COMMAND>

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

Usage: git-derive[EXE] add <PATH>...

Arguments:
<PATH>... Stuff to add
<PATH>... Stuff to add

Options:
-h, --help Print help information
-h, --help Print help information

```

Expand All @@ -59,10 +59,10 @@ adds things
Usage: git-derive[EXE] add <PATH>...

Arguments:
<PATH>... Stuff to add
<PATH>... 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"]
Expand All @@ -76,30 +76,30 @@ Usage: git-derive[EXE] stash [OPTIONS]
git-derive[EXE] stash <COMMAND>

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 <MESSAGE>
-h, --help Print help information
-m, --message <MESSAGE>
-h, --help Print help information

$ git-derive stash push -h
Usage: git-derive[EXE] stash push [OPTIONS]

Options:
-m, --message <MESSAGE>
-h, --help Print help information
-m, --message <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") }
Expand Down Expand Up @@ -130,12 +130,12 @@ Compare two commits
Usage: git-derive[EXE] diff [COMMIT] [COMMIT] [-- <PATH>]

Arguments:
[COMMIT]
[COMMIT]
[PATH]
[COMMIT]
[COMMIT]
[PATH]

Options:
-h, --help Print help information
-h, --help Print help information

$ git-derive diff
Diffing stage..worktree
Expand Down

0 comments on commit c95c9f2

Please sign in to comment.