Commit graph

3676 commits

Author SHA1 Message Date
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
CreepySkeleton
f4fb9db65c cargo fmt 2020-08-16 00:29:30 +03:00
CreepySkeleton
0b2eac4da7 Fix yaml support 2020-08-15 23:42:23 +03:00
CreepySkeleton
ce3171ace5 Arg::required_unless_all => required_unless_eq_all 2020-08-15 20:38:57 +03:00
CreepySkeleton
b12102c832 Arg::required_unless -> required_unless_present 2020-08-15 20:38:56 +03:00
CreepySkeleton
55dceca819 Improve documentation 2020-08-15 20:38:56 +03:00
CreepySkeleton
233af6e7a1 Arg::required_if => required_if_eq 2020-08-15 20:38:55 +03:00
CreepySkeleton
8b85c4ecea Arg::required_ifs => required_if_eq_any 2020-08-15 20:38:12 +03:00
CreepySkeleton
6b6b6035ed Arg::required_unless_one => required_unless_eq_any 2020-08-15 20:38:11 +03:00
tomjw64
481229fffd Remove stray print 2020-08-15 04:49:53 -05:00
tomjw64
826db05319 Add test for three argument conflict output 2020-08-15 04:43:12 -05:00
tomjw64
6602feb9e6 Also include required arguments in conflict output 2020-08-15 04:17:28 -05:00
tomjw64
4372aa0fa6 Enable assertions on conflict_output_with_required 2020-08-15 04:16:23 -05:00
tomjw64
b3e523912f Add new tests for usage including required args 2020-08-15 03:20:48 -05:00
tomjw64
937e14f6e8 Remove latter conflicting arg from usage message 2020-08-15 03:17:16 -05:00
tomjw64
fbb7a0f6e4 Re-enable conflict_output and conflict_output_rev 2020-08-15 03:16:47 -05:00
bors[bot]
ddd55e57dc
Merge #2069
2069: Added opencollective sponsors to readme r=CreepySkeleton a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-08-15 00:27:41 +00:00
bors[bot]
26aa746c3a
Merge #2067
2067: Use a template to produce the default help message r=pksunkara a=mkantor



Co-authored-by: Matt Kantor <the.matt.kantor@gmail.com>
2020-08-14 23:42:38 +00:00
Matt Kantor
85d3daa8c1 Use a different default template when there are no args.
This eliminates extraneous empty lines when there are no user-defined
args, the default args are disabled, and `after_help` is set.
2020-08-14 14:02:52 -07:00
Matt Kantor
de6a5af1b2 Add a (failing) test for no args + after help. 2020-08-14 13:58:56 -07:00
Matt Kantor
4545a47ff6 Fix: {before-help} should have fallback just like {after-help}. 2020-08-14 13:58:37 -07:00
bors[bot]
16cf7685d7
Merge #2072
2072: Fix YAML's default_value_if handling r=pksunkara a=bkaestner



Co-authored-by: Benjamin Kästner <benjamin.kaestner@gmail.com>
2020-08-14 17:05:08 +00:00
Benjamin Kästner
15c441708b Fix YAML null value in fixture
The YAML null value is called `null` in YAML, not `Null`. yaml-rust
handles those values according to spec, so we should use the correct
capitalization.

See https://yaml.org/spec/1.2/spec.html#id2803362 for more
information.
2020-08-14 18:28:43 +02:00
Benjamin Kästner
2b101ad7e5 Properly handle YAML null macros for default_value_if
The macro `yaml_opt_str` is only used in `yaml_tuple3`, which again is
only used for `default_value_if`. Unfortunately, the current test
doesn't make sense, as a v.is_null() indicates a Yaml::Null, on wich
`as_str()` always returns `None`. Instead, the condition should be
negated, as the documentation of `default_value_if` hints:

> **NOTE:** If using YAML the values should be laid out as
> follows (`None` can be represented as `null` in YAML)

The case `$v.is_null()` should therefore lead to `None`, whereas all
other cases should be interpreted `as_str()`.
2020-08-14 18:28:43 +02:00
Benjamin Kästner
8a2e9804d7 Provide tests for Arg::default_value_if
While reading the code for the yaml translation, I've noticed that
there is a bug in the macro `yaml_opt_str` as well as a wrong `null`
value in the test fixture.

These tests add the expected behaviour on the given fixture, e.g.

    prog
and
    prog <WRONG>
where `<WRONG>` is **not** `other` should yield `None` for
`"positional2"`, whereas

    prog other
should yield "something" and

    prog --flag ARBITRARY_VALUE
should yield "some". The first two tests

- default_value_if_not_triggered
- default_value_if_not_triggered_by_argument

fail, as the second positional arguments *gets set*, although its
conditions aren't fulfilled.
2020-08-14 18:28:12 +02:00
Matt Kantor
2c91800099 Restore details to doc comment for help_template. 2020-08-14 09:27:42 -07:00
Matt Kantor
afcacb0626 Apply wrapping to {author} and {about} template tags.
Previously wrapping was only applied to the {*-with-newline} variants.
2020-08-14 09:14:14 -07:00
Matt Kantor
059503e54d Make {before-help} and {after-help} template tags include padding.
Previously there were separate tags for this, {before-help-padded} and
{after-help-padded}. Those have been removed and the default ones
given their behavior.
2020-08-14 09:14:10 -07:00