Commit graph

2044 commits

Author SHA1 Message Date
Kevin K
cbea3d5acf docs(App::template): adds details about the necessity to use AppSettings::UnifiedHelpMessage when using {unified} tags in the help template
Closes #949
2017-05-16 07:23:22 -04:00
Kevin K
f9b0d65783 docs(Arg::allow_hyphen_values): updates the docs to include warnings for allow_hyphen_values and multiple(true) used together 2017-05-16 07:23:22 -04:00
Kevin K
ab2f4c9e56 fix: fixes a bug where args that allow values to start with a hyphen couldnt contain a double hyphen -- as a value
Closes #960
2017-05-16 07:23:22 -04:00
Kevin K
5209b61192 tests: adds tests for using double hyphen -- as a value 2017-05-16 07:23:22 -04:00
Guanqun Lu
34a7436dd3 trivial typo fixes 2017-05-11 20:52:35 -04:00
golem131
60cc838a42 Fix tests 2017-05-11 20:45:15 -04:00
golem131
3deb1943e0 Dependency update 2017-05-11 20:45:15 -04:00
Kevin K
54c16836de fix: fixes a bug where positional argument help text is misaligned 2017-05-10 20:29:54 -04:00
Kevin K
c556b39fd0 chore: increase version 2017-05-07 10:46:03 -04:00
Kevin K
9f9364b1d8 fix: fixes a bug where args with last(true) and required(true) set were not being printed in the usage string
Closes #944
2017-05-07 10:46:03 -04:00
Kevin K
3223f21a90 tests: adds tests to last(true) args are printed in the usage even when required 2017-05-07 10:46:03 -04:00
Kevin K
8713da2372 fix: fixes a bug that was printing the arg name, instead of value name when Arg::last(true) was used
Closes #940
2017-05-07 10:46:03 -04:00
Kevin K
3ed0f70c6e tests: adds tests to ensure positional values value name are used in usage strings instead of names when defined 2017-05-07 10:46:03 -04:00
Kevin K
fedb46b5b1 fix: fixes a bug where flags were parsed as flags AND positional values when specific combinations of settings were used
This commit fixes a bug where using `AppSettings::AllowHyphenValues`
would cause flags with longs be *also* parsed as positional values.

Closes #946
2017-05-07 10:46:03 -04:00
Kevin K
52d110df81 docs(AllowHyphenValues): updates the docs to remove old limitations that no longer apply 2017-05-07 10:46:03 -04:00
Kevin K
4048072021 tests: adds tests to ensure flags not incorrectly parsed as positionals 2017-05-07 10:46:03 -04:00
Kevin K
bd4dbb4214 chore: increase version 2017-05-05 18:59:32 +02:00
Homu
b7d874be87 Auto merge of #941 - nuew:default_value_os, r=kbknapp
api(Arg): add `default_value_os`

Also add related tests, and reframe `default_value` in terms of
`defualt_value_os`.

This resolves #849.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/kbknapp/clap-rs/941)
<!-- Reviewable:end -->
2017-05-05 09:57:29 +09:00
Nuew
d5ef895541
api(Arg): add default_value_os
Also add related tests, and reframe `default_value` in terms of
`defualt_value_os`.
2017-04-24 15:49:59 -04:00
Homu
dd485ebc6a Auto merge of #939 - golddranks:master, r=kbknapp
api(arg_matches.rs): Added a Default implementation for Values and OsValues iterators.

Fixes https://github.com/kbknapp/clap-rs/issues/935.

The iterators terminate with `None` on the first call to `.next()`.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/kbknapp/clap-rs/939)
<!-- Reviewable:end -->
2017-04-24 09:54:17 +09:00
Pyry Kontio
0a4384e350 api(arg_matches.rs): Added a Default implementation for Values and OsValues iterators. 2017-04-23 23:49:20 +09:00
Homu
448ba6a6f0 Auto merge of #938 - Kalwyn:master, r=kbknapp
docs(README.md): fix some typos

This is the first time i make a pull request. I hope i have done things right.
I love clap-rs very much. Thank you for your hard work.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/kbknapp/clap-rs/938)
<!-- Reviewable:end -->
2017-04-23 09:48:45 +09:00
Kalwyn Solork
fa34deac07 docs(README.md): fix some typos 2017-04-22 23:11:53 +02:00
Homu
de1fea4c66 Auto merge of #934 - kbknapp:issue-931, r=kbknapp
Issue 931

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/kbknapp/clap-rs/934)
<!-- Reviewable:end -->
2017-04-19 21:35:36 +09:00
Kevin K
2572150558
chore: increase version 2017-04-18 23:19:24 -04:00
Kevin K
85b0e1cc4b
imp(PowerShell Completions): massively dedups subcommand names in the generate script to make smaller scripts that are still functionally equiv 2017-04-18 23:17:05 -04:00
Kevin K
a8bce55837
fix(PowerShell Completions): fixes a bug where powershells completions cant be used if no subcommands are defined
Closes #931
2017-04-18 23:01:20 -04:00
Homu
3f44dd4b91 Auto merge of #926 - kbknapp:v2.23.2, r=kbknapp
V2.23.2

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/kbknapp/clap-rs/926)
<!-- Reviewable:end -->
2017-04-10 09:43:49 +09:00
Kevin K
f842e8fcec
chore: increase version 2017-04-09 14:40:43 -04:00
Kevin K
e05100b73d
imp: bumps term_size to take advantage of better terminal dimension handling 2017-04-09 14:39:38 -04:00
Homu
6cbc161a09 Auto merge of #925 - mdaffin:doc-typo-fix, r=kbknapp
docs: Fix a typo the minimum rust version required

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/kbknapp/clap-rs/925)
<!-- Reviewable:end -->
2017-04-07 23:56:08 +09:00
Michael Daffin
71dabba3ea docs: Fix a typo the minimum rust version required 2017-04-07 10:02:00 +01:00
Kevin K
6095f239ba chore: increase version 2017-04-05 10:59:55 -04:00
Kevin K
6aa4ba8114 fix: fixes a missing newline character in the autogenerated help and version messages in some instances 2017-04-05 10:59:55 -04:00
Homu
5b669ec520 Auto merge of #923 - kbknapp:issues-869,900,919,922, r=kbknapp
Issues 869,900,919,922

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/kbknapp/clap-rs/923)
<!-- Reviewable:end -->
2017-04-05 21:57:49 +09:00
Kevin K
cdae4fdf89 chore: increase version 2017-04-05 01:09:16 -04:00
Kevin K
f7a8877978 feat(clap_app!): adds support for arg names with hyphens similar to longs with hyphens
One can now use `("config-file")` style arg names

Closes #869
2017-04-05 00:57:47 -04:00
Kevin K
c83a559df1 tests(clap_app!): adds tests for ("config-file") style positonal args 2017-04-05 00:57:40 -04:00
Kevin K
bc08ef3e18 docs(clap_app!): documents the --("some-arg") method for using args with hyphens inside them
Closes #919
2017-04-05 00:47:19 -04:00
Kevin K
59272b06cc feat: allows distinguishing between short and long version messages (-V/short or --version/long)
One can now use `App::long_version` to dsiplay a different (presumably
longer) message when `--version` is called. This commit also adds the
corresponding print/write long version methods of `App`
2017-04-05 00:42:43 -04:00
Kevin K
d82b4be5d7 api: adds new App method calls for printing and writing the long version of help messages
One can now use `App::print_long_help` or `App::write_long_help`

Note that `App::write_long_help` is **NOT** affected by kbknapp/clap-rs#808 in the manner
that `App::write_help` help is and thus should be preferred if at all possible.
2017-04-05 00:42:43 -04:00
Kevin K
6b371891a1 feat: allows distinguishing between short and long help with subcommands in the same manner as args
One can use `App::about` for `-h` short help messsages or
`App::long_about` for `--help` long help messages.
2017-04-05 00:42:43 -04:00
Kevin K
ef1b24c3a0 feat: allows specifying a short help vs a long help (i.e. varying levels of detail depending on if -h or --help was used)
One can now use `Arg::long_help` which will be displayed when the user
runs `--help`. This is typically longer form content and will be
displayed using the NextLineHelp methodology.

If one specifies the standard `Arg::help` it will be displayed when the
user runs `-h` (by default, unless the help short has been overridden).
The help text will be displayed in the typical clap fashion.

The help format requested (-h/short or --help/long) will be the
*default* displayed. Meaning, if one runs `--help` (long) but only an
`Arg::help` has been provided, the message from `Arg::help` will be
used. Likewise, if one requests `-h` (short) but only
`Arg::long_help` was provided, `Arg::long_help` will be displayed appropriately
wrapped and aligned.

Completion script generation *only* uses `Arg::help` in order to be
concise.

cc @BurntSushi thanks for the idea!
2017-04-05 00:42:43 -04:00
Kevin K
b48a5bb930 chore: bump minor version due to bug fix that may break code that was relying on said bug 2017-04-04 20:11:33 -04:00
Kevin K
8b2ceb8368 fix: fixes a bug that wasn't allowing help and version to be properly overridden
One should be able to override the auto generated help and version flags
by simply providing an arg with a long of `help` or `version`
respectively. This bug was preventing that from happening.

However, now that it's fixed if one was relying on adding an arg with a
long of `help` or `version` and using `get_matches_safe` to produce the
`ErrorKind::HelpDisplayed` or `ErrorKind::VersionDisplayed` errors they
**WILL NOT** happen anymore.

This is because the bug was causing those "errors" to occur (i.e. the
help or version message to be displayed). The "fix" to get that
functionality back is to either:

 * Remove the arg with the long of `help` or `version`
 * Use `ArgMatches::is_present` instead of `App::get_matches_safe` to check for the presence of your custom help or version flag

Option 1 is the easiest provided one wasn't using said arg to *also*
override other aspects of the flags as well (short, help message, etc.)

Even though this may break some code, as per the compatibility policy
listed in the readme; code that breaks due to relying on a bug does
*not* constitute a major version bump. I will however be bumping the
minor version instead of just the patch version. I will also be
searching for, contacting, and attempting to submit PRs to any affected
projects prior to releasing the next version to crates.io

Closes #922
2017-04-04 19:59:03 -04:00
Kevin K
92cc30577d tests: adds tests to verify help and version can be properly overridden 2017-04-04 19:56:34 -04:00
Homu
080a9d8bfe Auto merge of #921 - kbknapp:template-fix, r=kbknapp
Template fix

Fixes BurntSushi/ripgrep#426 and BurntSushi/ripgrep#418

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/kbknapp/clap-rs/921)
<!-- Reviewable:end -->
2017-03-31 05:00:54 +09:00
Kevin K
f93cadd74b tests: fixes a missing import for a doctest and uses conditional doc-testing 2017-03-30 15:19:17 -04:00
Kevin K
8bcc4d632c chore: increase version 2017-03-30 13:35:36 -04:00
Kevin K
0e4fd96d74 fix(Custom Usage Strings): fixes the usage string regression when using help templates 2017-03-30 13:30:23 -04:00