Skip to content

Commit 023981c

Browse files
committed
Merge pull request #160 from kbknapp/feature-rollup
perf: improves help message printing drastically
2 parents 8889689 + 8232f7b commit 023981c

File tree

4 files changed

+257
-155
lines changed

4 files changed

+257
-155
lines changed

README.md

+8-18
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,14 @@ It is a simple to use, efficient, and full featured library for parsing command
88

99
## What's New
1010

11-
If you're already familiar with `clap` but just want to see some new highlights as of **1.0.3**
12-
13-
* **Errors are written to stderr** - In order to follow good standards, errors are now written to stderr
14-
* **Deprecated Functions Removed** - In an effort to start a 1.x all deprecated functions have been removed, see the deprecations sections below to update your code (very minimal)
15-
* **Can fully override help** - This allows you fully override the auto-generated help if you so choose
16-
* **Can wait for user input on error** - This is helpful mainly on Windows if a user mistakenly opens your application via double-click, or you'd like to provide a GUI shortcut to run your application
17-
* **Args can now be parsed from arbitrary locations** This makes testing immensly easier. Thanks to [cristicbz](https://github.com/cristicbz) for the idea!
18-
19-
Example...
20-
21-
```rust
22-
let v = vec!["my_prog", "some_arg", "-f"];
23-
let m = App::new("my_prog")
24-
// Normal configuration goes here...
25-
.get_matches_from(v);
26-
27-
// Use matches like normal...
28-
```
11+
If you're already familiar with `clap` but just want to see some new highlights as of **1.1.0**
12+
13+
* **Newlines properly aligned in help strings!** - Allows one to specify a newline in long help strings. **Note:** Specify the newlines in help strings via `{n}` and *not* `\n` due to how `clap` handles help parsing.
14+
* **Unified Help Format** - This is cosmetic only, but allows a help message formated similiar to `docopt` or `getopts` where what `clap` calls "options" and "flags" are combined into a single group (and still properly aligned and formatted)
15+
* **Can propogate versions through subcommands auto-matically** - This allows all subcommands to handle `--version` or `-V` with the same version as the parent application
16+
* **Can specify that subcommands disable version** - Can now say `--version` and `-V` won't be valid flags for subcommands
17+
* **Big performacne improvement when printing help messages** - While printing help messages wasn't slow before, it's now super fast ;)
18+
* **PSA: Deprecated Functions Removed as of 1.0** - In an effort to start a 1.x all deprecated functions have been removed, see the deprecations sections below to update your code (very minimal)
2919

3020
For full details see the [changelog](https://github.com/kbknapp/clap-rs/blob/master/CHANGELOG.md)
3121

clap-tests/run_tests.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
tests clap library
1313
1414
USAGE:
15-
claptests [FLAGS] [OPTIONS] [ARGS] [SUBCOMMAND]
15+
\tclaptests [FLAGS] [OPTIONS] [ARGS] [SUBCOMMAND]
1616
1717
FLAGS:
1818
-f, --flag tests flags
@@ -27,12 +27,12 @@
2727
--multvalsmo <one> <two> Tests mutliple values, not mult occs
2828
-o, --option <opt>... tests options
2929
--long-option-2 <option2> tests long options with exclusions
30-
-O, --Option <option3> tests options with specific value sets [values: fast, slow]
30+
-O, --Option <option3> tests options with specific value sets [values: fast slow]
3131
3232
ARGS:
33-
positional tests positionals
34-
positional2 tests positionals with exclusions
35-
positional3... tests positionals with specific values [values: emacs, vi]
33+
positional tests positionals
34+
positional2 tests positionals with exclusions
35+
positional3... tests positionals with specific values [values: emacs vi]
3636
3737
SUBCOMMANDS:
3838
help Prints this message
@@ -138,18 +138,18 @@
138138
tests subcommands
139139
140140
USAGE:
141-
claptests subcmd [FLAGS] [OPTIONS] [ARGS]
141+
\tclaptests subcmd [FLAGS] [OPTIONS] [ARGS]
142142
143143
FLAGS:
144144
-f, --flag tests flags
145145
-h, --help Prints help information
146146
-V, --version Prints version information
147147
148148
OPTIONS:
149-
-o, --option <scoption>... tests options
149+
-o, --option <scoption>... tests options
150150
151151
ARGS:
152-
scpositional tests positionals'''
152+
scpositional tests positionals'''
153153

154154
_scfop = '''flag NOT present
155155
option NOT present

0 commit comments

Comments
 (0)