Commit graph

406 commits

Author SHA1 Message Date
NickHackman
d785ebc14e fix: Flag Subcommands tests behind debug_asserts
Tests that check conflicts are behind the `debug_assertions` feature
2020-06-17 01:53:53 -04:00
NickHackman
32db427706 fix: duplicate short flags in Flag Subcommand test 2020-06-17 01:14:48 -04:00
NickHackman
f7c5b098b9 fix: duplicate flags in Flag Subcommand test 2020-06-17 00:56:05 -04:00
NickHackman
bf3d947f01 fix: Flag Subcommands conflicts panic
Conflicts with Flag subcommands and Args now panics when
`debug_assertions` is enabled, rather than causing bizarre behavior.
2020-06-16 23:45:21 -04:00
NickHackman
383606e099 tests: short_flag_alias methods
Tests that cover all methods for `short_flag_alias` corresponding methods
2020-06-16 01:11:53 -04:00
NickHackman
458736bee8 imp: Improved Flag Subcommand API
Instead of a `FlagSubCommand` struct the addition of two simple methods
to `App`. `App::long_flag` and `App::short_flag` that cover all the
bases of the many methods that were provided in `FlagSubCommand`. This
API is far simpler to use and more akin to the present `Arg::long` and `Arg::short`.
2020-06-15 21:52:36 -04:00
NickHackman
c89718fa57 tests: FlagSubCommand
Test all methods of `FlagSubCommand` and interactions with aliases
2020-06-13 11:32:24 -04:00
Andreas Steding
49cb37b303 Updated tests. 2020-06-10 15:45:27 +02:00
Artem Vorotnikov
7a6310e26d
Update multiple_custom_help_headers test to cover #1955 2020-06-01 09:04:41 +03:00
CreepySkeleton
41c4d186f1 Fix warnings 2020-05-31 17:53:24 +03:00
Roy Ivy III
fbfe9eedf8 tests ~ add tests for new 'default_missing_value' configuration option 2020-05-21 13:06:45 -05:00
CreepySkeleton
5589276093 Rename App::set_term_width to term_width
None of the other methods that move self have the `set_` prefix
2020-05-18 12:46:14 +03:00
Patrick Marks
4a9e01b0bc ensure that validation failure error message includes a newline. also add a basic test of a failed validation 2020-05-17 08:50:35 -07:00
Patrick Marks
cb425946b7 fix test 2020-05-15 08:25:01 -07:00
Patrick Marks
97e3d8c0ac fix some cases of the 'The following required arguments were not provided' error message 2020-05-15 07:58:57 -07:00
Pavan Kumar Sunkara
7bc282dd4e Rename with_name to new for Arg & ArgGroup 2020-05-14 22:50:56 +02:00
Pavan Kumar Sunkara
51723e7678
Apply suggestions from code review 2020-05-12 15:34:05 +02:00
Pavan Kumar Sunkara
cfb0e95c9e Fix some stuff 2020-05-12 10:39:24 +02:00
Mark Thebridge
8fc099469d fix(parser): Better interaction between AllowExternalSubcommands and SubcommandRequired 2020-05-12 00:57:35 +02:00
Peter Corlett
719161ebba fix(macros): fixes broken pattern which prevented calling multi-argument Arg methods 2020-05-12 00:45:32 +02:00
Windfarer
2b2dbbc506 adding case_insensitive to yaml parsing 2020-05-12 00:36:47 +02:00
bors[bot]
33c63c6e29
Merge #1901
1901: implement Arg::short_alias and Arg::short_aliases r=pksunkara a=connorskees



Co-authored-by: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com>
2020-05-11 16:03:51 +00:00
ConnorSkees
59f3e9414b allow short aliases on Arg
this implements Arg::short_alias, Arg::short_aliases,
Arg::short_visible_alias, and Arg::short_visible_aliases in addition to
adding their associated tests
2020-05-11 11:21:01 -04:00
Jack O'Connor
952309c8d6 add tests for invalid UTF-16 on Windows
These are similar to the tests backported to the 2.x branch in
https://github.com/clap-rs/clap/pull/1907. These are more comprehensive,
because the OsStr splitting methods are more robust now.
2020-05-05 18:18:30 -04:00
CreepySkeleton
56fdfb9edd Eradicate warnings and errors: tests and examples 2020-05-02 23:33:47 +03:00
CreepySkeleton
ec6b6e1e36 Make validator take &str instead of String 2020-05-01 14:21:11 +03:00
creativcoder
d0abb378b0 cargo fmt 2020-04-27 20:41:41 +05:30
creativcoder
970c1fa21a Fix yaml tests 2020-04-27 20:19:26 +05:30
creativcoder
92d5920748 Updated test and usage of older help APIs with about 2020-04-27 02:42:07 +05:30
CreepySkeleton
cdb184b76c Add a test 2020-04-26 21:16:14 +03:00
CreepySkeleton
2403ae796e
Apply suggestions from code review
Co-Authored-By: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-04-24 23:06:13 +03:00
CreepySkeleton
f69ec92a83 Improve panics 2020-04-24 22:34:23 +03:00
CreepySkeleton
7a09195fcb Add a test 2020-04-24 13:05:46 +03:00
CreepySkeleton
61a12e4296 Fix positional args in groups (#1794) 2020-04-24 13:05:46 +03:00
bors[bot]
c1cb0ce359
Merge #1849
1849: Arg enum r=CreepySkeleton a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-04-22 17:23:43 +00:00
Pavan Kumar Sunkara
dbe6ac01f6 Clean up arg_enum 2020-04-22 14:38:16 +02:00
CreepySkeleton
0e7ff777da Make sure that command line OVERRIDES env, not prepends (fix #1835) 2020-04-22 11:35:20 +03:00
CreepySkeleton
bec16ae9e0 Add tests 2020-04-20 18:29:45 +03:00
Donnie Adams
0584b57f29 fix: Don't print 'OPTIONS' when all options are hidden for short help 2020-04-16 08:21:41 -07:00
Pavan Kumar Sunkara
070bd50b28 Finished color refactor 2020-04-16 12:51:26 +02:00
Pavan Kumar Sunkara
da32adeb0e Allow literals in builder macros 2020-04-12 23:18:39 +02:00
Ivan Tham
22ed69e857 Add test for suboptimal flag suggestion
Fix #1073
2020-04-12 23:44:48 +08:00
Pavan Kumar Sunkara
333b993481 Remove {n} support 2020-04-12 03:37:21 +02:00
CreepySkeleton
7cff206194 Make all fields of App & Arg pub(crate) 2020-04-11 18:23:20 +03:00
Bence Kalmar
4bf3f97d28 fix(arg_enum!): Invalid expansions of some trailing-comma patterns
In particular, fix macros that take an enum of one of the the following forms:

 - `#[...] enum { ... , }`
 - `pub enum { ... , }`
 - `enum { ... , }`

Previously, these expansions would result in an error message like "error: no
rules expected the token `:`".

Add extensive tests for each pattern.  Only two of the patterns had tests
before, so these errors did not surface automatically.
2020-04-10 09:35:20 +02:00
Ivan Veselov
0f3bdc439e Fix ArgMatcher consuming extra arguments when max_values is set 2020-04-10 09:35:20 +02:00
Pavan Kumar Sunkara
15edb69a0d Address review comments 2020-04-10 00:33:16 +02:00
Pavan Kumar Sunkara
f0a216036b Fix some issues 2020-04-09 19:41:33 +02:00
Pavan Kumar Sunkara
92449a4777 Assert arg groups 2020-04-09 16:51:32 +02:00
Pavan Kumar Sunkara
00a0b9660a Assert for require* on args 2020-04-09 16:51:32 +02:00