Skip to content

Commit

Permalink
Merge pull request #160 from kbknapp/feature-rollup
Browse files Browse the repository at this point in the history
perf: improves help message printing drastically
  • Loading branch information
kbknapp committed Jul 16, 2015
2 parents 8889689 + 8232f7b commit 023981c
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 155 deletions.
26 changes: 8 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,14 @@ It is a simple to use, efficient, and full featured library for parsing command

## What's New

If you're already familiar with `clap` but just want to see some new highlights as of **1.0.3**

* **Errors are written to stderr** - In order to follow good standards, errors are now written to stderr
* **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)
* **Can fully override help** - This allows you fully override the auto-generated help if you so choose
* **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
* **Args can now be parsed from arbitrary locations** This makes testing immensly easier. Thanks to [cristicbz](https://github.com/cristicbz) for the idea!

Example...

```rust
let v = vec!["my_prog", "some_arg", "-f"];
let m = App::new("my_prog")
// Normal configuration goes here...
.get_matches_from(v);

// Use matches like normal...
```
If you're already familiar with `clap` but just want to see some new highlights as of **1.1.0**

* **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.
* **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)
* **Can propogate versions through subcommands auto-matically** - This allows all subcommands to handle `--version` or `-V` with the same version as the parent application
* **Can specify that subcommands disable version** - Can now say `--version` and `-V` won't be valid flags for subcommands
* **Big performacne improvement when printing help messages** - While printing help messages wasn't slow before, it's now super fast ;)
* **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)

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

Expand Down
16 changes: 8 additions & 8 deletions clap-tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
tests clap library
USAGE:
claptests [FLAGS] [OPTIONS] [ARGS] [SUBCOMMAND]
\tclaptests [FLAGS] [OPTIONS] [ARGS] [SUBCOMMAND]
FLAGS:
-f, --flag tests flags
Expand All @@ -27,12 +27,12 @@
--multvalsmo <one> <two> Tests mutliple values, not mult occs
-o, --option <opt>... tests options
--long-option-2 <option2> tests long options with exclusions
-O, --Option <option3> tests options with specific value sets [values: fast, slow]
-O, --Option <option3> tests options with specific value sets [values: fast slow]
ARGS:
positional tests positionals
positional2 tests positionals with exclusions
positional3... tests positionals with specific values [values: emacs, vi]
positional tests positionals
positional2 tests positionals with exclusions
positional3... tests positionals with specific values [values: emacs vi]
SUBCOMMANDS:
help Prints this message
Expand Down Expand Up @@ -138,18 +138,18 @@
tests subcommands
USAGE:
claptests subcmd [FLAGS] [OPTIONS] [ARGS]
\tclaptests subcmd [FLAGS] [OPTIONS] [ARGS]
FLAGS:
-f, --flag tests flags
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-o, --option <scoption>... tests options
-o, --option <scoption>... tests options
ARGS:
scpositional tests positionals'''
scpositional tests positionals'''

_scfop = '''flag NOT present
option NOT present
Expand Down
Loading

0 comments on commit 023981c

Please sign in to comment.