Commit graph

3753 commits

Author SHA1 Message Date
Pavan Kumar Sunkara
9e381f92a9 Rename required_unless_eq_* to required_unless_present_* 2020-08-29 11:48:35 +02:00
bors[bot]
769372f651
Merge #2116
2116: Implement std::error::Error for clap::Error r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-29 08:27:30 +00:00
CreepySkeleton
ccb1ea2d65 Remove useless code
This code does not serve any purpose as far as I can tell
2020-08-29 00:44:11 +03:00
CreepySkeleton
3a099a6627 Implement std::error::Error for clap::Error 2020-08-28 20:57:39 +03:00
bors[bot]
e4b5407296
Merge #1976 #2073
1976: Refactor r=pksunkara a=CreepySkeleton



2073: Add new "regex" feature r=CreepySkeleton a=bkaestner



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
Co-authored-by: Benjamin Kästner <benjamin.kaestner@gmail.com>
2020-08-28 17:14:31 +00:00
bors[bot]
f6061c0f59
Merge #2114
2114: Changelog r=CreepySkeleton a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-08-28 16:46:52 +00:00
CreepySkeleton
5020333037 Refactor coloring 2020-08-28 19:21:05 +03:00
Pavan Kumar Sunkara
cfd1826052 Update changelog and upgrader 2020-08-28 17:27:47 +02:00
Pavan Kumar Sunkara
21f3705e61 Remove contributors in favor of point to github graphs 2020-08-28 17:11:27 +02:00
bors[bot]
16f92288f1
Merge #2115
2115: Adjust stderr files r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-28 11:31:47 +00:00
CreepySkeleton
f97b4cb1c7 Adjust stderr files 2020-08-28 13:51:58 +03:00
Benjamin Kästner
cde1a2d218 regex: Introduce convenience Cow-wrapper RegexRef
As previously discussed on [GitHub], this commit introduces a Cow-like
wrapper RegexRef to enable both `Regex` as well as `&Regex` as
arguments.

It also introduces a new module in the `build:arg` path to remove
clutter from the main module. For more information see #2073.

 [GitHub]: https://github.com/clap-rs/clap/pull/2073#issuecomment-674442310
2020-08-26 17:54:54 +02:00
Benjamin Kästner
8cb9a7d486 Add new "regex" feature
This commit introduces a new feature called `"regex"`. It adds a new
function `validator_regex` to `Arg` and was inspired by the discussion
in #1968. The name `validator_regex` was chosen instead of
`regex_validator` to make sure that the developer keeps in mind that
there may only be a single `Validator` on an `Arg`.

The feature can be used with YAML files, however there is no proper
pattern in `clap_app!` (yet).
2020-08-26 17:54:54 +02:00
bors[bot]
ebecccd009
Merge #2110
2110: Allow flatten with doc comments r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-26 07:13:34 +00:00
CreepySkeleton
a951958748 Allow flatten with doc comments 2020-08-25 20:20:56 +03:00
bors[bot]
8c47449bb5
Merge #2109
2109: fix: detect if space should be added before spec_vals r=CreepySkeleton a=knidarkness



Co-authored-by: knidarkness <knidarkness@gmail.com>
Co-authored-by: Sergey Dubovyk <knidarkness@gmail.com>
2020-08-25 13:35:22 +00:00
Sergey Dubovyk
d525be42c5
chore: use if instead of matching
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-25 11:07:19 +03:00
knidarkness
530b179776 fix: detect if space should be added before spec_vals 2020-08-25 10:41:08 +03:00
bors[bot]
ca368e5018
Merge #2104
2104: Basic centralized sanity test for all examples r=pksunkara a=mkantor



Co-authored-by: Matt Kantor <the.matt.kantor@gmail.com>
2020-08-24 18:44:43 +00:00
Matt Kantor
44ee8284c5 Exclude tests/examples.rs while checking coverage. 2020-08-24 10:23:49 -07:00
bors[bot]
29df5c2d16
Merge #2100 #2106
2100: Allow for nested subcommands with ZSH generation. r=pksunkara a=newAM



2106: Update the env var example for derive r=pksunkara a=rgreinho



Co-authored-by: Alex M <alexmgit@protonmail.com>
Co-authored-by: Rémy Greinhofer <remy.greinhofer@gmail.com>
2020-08-24 06:45:45 +00:00
bors[bot]
7853903052
Merge #2102
2102: Fix propagation r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-24 06:22:27 +00:00
Rémy Greinhofer
2a2cf81977 Update the env var example for derive
Updates the derive example handling environment variables to illustrate
the case where it contains a sensitive value which should not be
displayed on the help screen.

Closes https://github.com/clap-rs/clap/issues/2101
2020-08-23 18:18:25 -05:00
Matt Kantor
882f553c6a Test that --help works for all examples. 2020-08-23 11:23:43 -07:00
Matt Kantor
b41384d320 Make all examples compile & run without failure. 2020-08-23 11:23:43 -07:00
CreepySkeleton
1cd069090e Fix propagation 2020-08-23 20:56:29 +03:00
Alex M
60dfcf13b5 Allow for nested subcommands with ZSH generation. 2020-08-23 09:33:29 -07:00
bors[bot]
6a56a82629
Merge #2096
2096: Fix a few documentation typos r=CreepySkeleton a=drguildo



Co-authored-by: Simon Morgan <sjm@sjm.io>
2020-08-22 16:50:19 +00:00
Simon Morgan
2e973a2649 Fix a few documentation typos 2020-08-22 16:49:09 +01:00
bors[bot]
317a816857
Merge #2092
2092: Make caching in crate_authors! actually work r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-21 09:08:54 +00:00
CreepySkeleton
28ad25fe66 Ensure the lifetime is 'static 2020-08-21 08:41:50 +03:00
CreepySkeleton
fd1ee7872e Make caching in crate_authors! actually work 2020-08-21 08:21:21 +03:00
bors[bot]
ed3bb993c5
Merge #2087
2087: refactor: Avoid second traversal and unwrap r=pksunkara a=phimuemue



Co-authored-by: philipp <descpl@yahoo.de>
2020-08-21 03:56:53 +00:00
bors[bot]
977a44684c
Merge #2089
2089: Forbid all unsafe code. r=CreepySkeleton a=aspenluxxxy



Co-authored-by: aspen <luxx4x@protonmail.com>
2020-08-21 03:34:19 +00:00
aspen
96b7fd454b
Forbid all unsafe code. 2020-08-20 18:38:40 -04:00
bors[bot]
8454136126
Merge #2085
2085: Don't print spaces in long help r=pksunkara a=knightpp



Co-authored-by: Danil Kondratiev <knightpp@protonmail.com>
2020-08-20 17:42:58 +00:00
philipp
86dc14f5cd refactor: Avoid second traversal and unwrap 2020-08-20 19:32:53 +02:00
Danil Kondratiev
5b07c8a780
fix spaces in long help tests 2020-08-20 17:28:40 +03:00
Danil Kondratiev
4878f7b7b1
don't print spaces in long help 2020-08-20 17:25:36 +03:00
bors[bot]
be27f41f83
Merge #2082
2082: Do not capture args meant for libtest from the integration tests r=pksunkara a=mkantor



Co-authored-by: Matt Kantor <the.matt.kantor@gmail.com>
2020-08-18 21:02:34 +00:00
Matt Kantor
247d823314 Do not capture args meant for libtest from integration tests.
Using `App::get_matches` from the integration tests meant that any
CLI arguments passed to libtest would also be captured by clap, often
causing the tests to fail.

For example, running `cargo test --test help -- --nocapture` would
result in several failed tests, even though `cargo test --test help`
worked fine. This was very surprising/confusing.

This commit makes the tests no longer implicitly rely on the value of
`env::args_os()`, which means developers can now provide arguments to
libtest without failures.
2020-08-18 11:50:48 -07:00
bors[bot]
1e3d53fd1f
Merge #2081
2081: Polish doc comments for App r=CreepySkeleton a=mkantor



Co-authored-by: Matt Kantor <the.matt.kantor@gmail.com>
2020-08-17 20:56:13 +00:00
bors[bot]
025ec3c28b
Merge #2078
2078: Unify naming cheme r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-17 20:35:05 +00:00
Matt Kantor
f6e28c5ff0 Remove doc mention of no-longer-existing from_yaml method. 2020-08-17 12:54:24 -07:00
CreepySkeleton
0cc8663db3 Fix benches 2020-08-17 22:27:50 +03:00
Matt Kantor
494fddd06e Polish doc comments for App.
- Fix some links.
- Make the punctuation consistent.
- Correct some spelling/grammar mistakes.
2020-08-17 11:00:00 -07:00
bors[bot]
91cc8031a3
Merge #2075
2075: Issue 1464 r=pksunkara a=tomjw64



Co-authored-by: tomjw64 <tom.jw64@gmail.com>
2020-08-16 20:08:12 +00:00
tomjw64
27771ceeb7 Show arguments in conflict message in reverse order of input 2020-08-16 03:47:19 -05:00
tomjw64
97149e37f5 Remove underscore prefix for build_conflict_err_usage 2020-08-16 03:42:58 -05:00
tomjw64
35f761e699 Extract extra logic to _build_conflict_err_usage 2020-08-15 17:58:47 -05:00