Commit graph

203 commits

Author SHA1 Message Date
CreepySkeleton
3e865e565f A little cleanup 2020-04-25 15:57:12 +03:00
bors[bot]
0293fd7c4a
Merge #1851
1851: Allow debug logs to work with clap tests themselves r=CreepySkeleton a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-04-22 20:01:24 +00:00
Pavan Kumar Sunkara
f0074752b9 Improve debug logs 2020-04-22 20:56:35 +02:00
Pavan Kumar Sunkara
dbe6ac01f6 Clean up arg_enum 2020-04-22 14:38:16 +02:00
Pavan Kumar Sunkara
070bd50b28 Finished color refactor 2020-04-16 12:51:26 +02:00
CreepySkeleton
8d01bce5df Use ref instead of move 2020-04-16 04:52:02 +03:00
CreepySkeleton
f931c3d1e4 Suppress unused_valiables lint in non-debug builds 2020-04-16 04:32:17 +03:00
CreepySkeleton
00f2a82c3e Make debug output much more useful 2020-04-14 07:21:27 +03:00
bors[bot]
500f34a8f6
Merge #1811
1811: Replace value_t*! macros with methods r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-04-13 07:49:00 +00:00
CreepySkeleton
af95c2b6a4 Replace value_t*! macros with methods 2020-04-13 04:20:09 +03:00
Pavan Kumar Sunkara
da32adeb0e Allow literals in builder macros 2020-04-12 23:18:39 +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
AimainaHito
06b9b32d66 Added full-stop 2020-04-04 11:30:30 +02:00
AimainaHito
f472393b14 Updated value_t documentation 2020-04-03 20:32:36 +02:00
Mátyás Mustoha
8687794986 style: fix comma placement for valid values when using arg_enum 2020-04-01 00:01:51 +02:00
bors[bot]
2aa38e81a9
Merge #1739
1739: Remove _some_ of pubs r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-03-19 23:53:18 +00:00
CreepySkeleton
4fc4a00b8f Remove _some_ of pubs 2020-03-19 10:17:52 +03:00
CreepySkeleton
b61a807728 Fix clippy and bump MSRV 2020-03-13 22:41:40 +03:00
Pavan Kumar Sunkara
47782cfac6 Make cargo feature additive 2020-03-01 22:55:57 +01:00
bors[bot]
28c46b5965
Merge #1697
1697: Allow replacing input on the fly r=CreepySkeleton a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-02-21 19:13:59 +00:00
Pavan Kumar Sunkara
b8851a7d5e Allow replacing input on the fly 2020-02-21 18:15:33 +01:00
Cecile Tonglet
35b918bd72 Allow missing docs on arg_enum 2020-02-21 11:39:44 +01:00
Pavan Kumar Sunkara
33f47acc67 Refactor clap_generate 2020-02-07 07:52:04 +01:00
CreepySkeleton
ffad57c776
Update src/macros.rs
Co-Authored-By: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-02-05 10:44:20 +03:00
CreepySkeleton
28605ba326 Fix macro 2020-02-05 10:17:11 +03:00
CreepySkeleton
afac737f69 Minor refactoring 2020-02-04 19:02:29 +03:00
danieleades
af45420027 style: format code with rustfmt (#1632)
> incidentally, how do we feel about adding a rustfmt check to the CI(s)?
yes we should be doing that. you can send another pr that adds the check to the Ci
2020-01-11 23:45:46 +05:30
Sergey "Shnatsel" Davidoff
0a010a4371 Add comment on performance 2019-11-02 21:03:35 +01:00
Sergey "Shnatsel" Davidoff
925956d594 Do not leak a new string on every invocation of crate_authors! 2019-11-02 20:18:57 +01:00
Sergey "Shnatsel" Davidoff
0085bb7ee2 Make code actually work 2019-11-02 19:48:16 +01:00
Sergey "Shnatsel" Davidoff
63829a2a9f Drop unnecessary unsafe 2019-11-02 18:33:17 +01:00
shua
452b80d334 add subcommand expr macro 2019-10-30 00:22:05 -04:00
Brian Foley
56d182d98b
Qualify all names in bodies of exported macros with $crate::
The lack of qualification caused odd errors such as:

```
use clap;
let foo = clap::value_t!(matches.value_of("foo"),i u32).unwrap(); # OK
lot bar = clap::value_t!(matches, "bar", u32).unwrap(); # Compile fail
```

but

```
use clap::value_t;
let foo = value_t!(matches.value_of("foo"),i u32).unwrap(); # OK
lot bar = value_t!(matches, "bar", u32).unwrap(); # OK
```
2019-10-29 21:48:49 -04:00
demoray
7f835ed24d
use std::sync::Once::new() rather than ONCE_INIT
Updated to v3-master per discussion on #1521
2019-07-23 10:03:07 -04:00
Erick Tryzelaar
2664703587 Fix most warnings
This patch:

* Removes unused `App::contains_long`
* Removes `std::ascii::AsciiExt` (deprecated in 1.26)
* Replaces `trim_left_matches` with `trim_start_matches` (added in 1.30)
* Adds `dyn` (added in 1.27)
* Removes unused `mkeymap::KeyType::{is_short,is_long}`
* Cleans up unused imports
2019-06-19 15:47:50 -07:00
Kevin K
fcbae1574a
style: rustfmt run 2019-04-05 20:21:33 -04:00
Kevin K
573b0a9e88
chore: upgrades to 2018 edition of Rust 2019-04-05 20:21:30 -04:00
Kevin K
4cc85990fd
refactor: removed strings as an internal ID for arguments, groups, and
subcommands

This commit changes the internal ID to a u64 which will allow for
greater optimizations down the road. In addition, it lays the ground
work for allowing users to use things like enum variants as argument
keys instead of strings.

The only downside is each key needs to be hashed (the implementation
used is an FNV hasher for performance). However, the performance gains
in faster iteration, comparison, etc. should easily outweigh the single
hash of each argument.

Another benefit of if this commit is the removal of several lifetime
parameters, as it stands Arg and App now only have a single lifetime
parameter, and ArgMatches and ArgGroup have no lifetime parameter.
2019-04-05 20:21:22 -04:00
Erich Gubler
ab65a0200d
Use $crate prepend to make importing the _clap_count_exprs macro unnecessary 2019-04-04 13:21:28 -04:00
Kevin K
2a480451d3 refactor: clippy run 2018-11-14 14:01:48 -05:00
Kevin K
20c72525d2 style: cargo fmt run 2018-11-14 12:05:06 -05:00
Kevin K
0de9e07412
Merge branch 'v3-master' into map 2018-11-13 22:07:16 -05:00
Kevin K
03333800fe refactor: remove code going to other crates and deprecations 2018-10-19 23:31:06 -04:00
Alena Yuryeva
c501773ed3 Tests on flags passing 2018-08-11 20:34:40 +03:00
Kevin K
f4e19a3193
Merge branch 'map' of github.com:clap-rs/clap into map 2018-08-04 19:22:52 -04:00
Kevin K
4ff03096fb
fix: fixes rebase errors 2018-08-04 19:14:13 -04:00
Alena Yuryeva
87c88d6054
Arg-specific API for MKeyMap 2018-08-04 18:37:35 -04:00
Alena Yuryeva
272170e333
WIP 2018-08-04 18:32:08 -04:00
Alena Yuryeva
7e5a6935b9
WIP. Big reformat 2018-08-04 18:22:10 -04:00