Rémi Lauzier
c4f534228b
Fix some nightly clippy warnings
2021-06-16 23:25:13 -04:00
Pavan Kumar Sunkara
3f94d17c71
Removed Arg::multiple
2021-06-16 07:17:11 +01:00
Eric Langlois
c20acaf2d4
Derived ArgEnum::from_str returns Err instead of panicking
...
ArgEnum is public so it is possible for users to call it with
a non-variant input string.
2021-06-08 16:40:12 -04:00
Felipe Sere
46cd4fe664
Run fmt
2021-05-19 19:43:06 +01:00
Kat Marchán
814b56dccb
feat(derive): Add support from inheriting global options in subcommands
2021-05-18 17:39:51 +01:00
liudingming
4dfc900a99
Clippy fix
2021-05-07 15:20:03 +08:00
Pavan Kumar Sunkara
d9fb11eba2
Apply cargo-intraconv
2021-03-13 14:11:47 +05:30
Omar El Halabi
777e0f43cb
fix: subcommand with field name subcmd compilation
2021-03-10 19:49:41 +02:00
Logan SQUIREL
cd8660fbd0
Fix issue #2181
...
- help / version flag report correct application name when generated
with clap_derive and an Enum.
- add clap_derive unit tests for application name:
file: clap_derive/tests/app_name.rs
tests: app_name_in_[short|long]_[help|version]_from_[struct|enum]()
2021-02-22 15:01:02 +01:00
Pavan Kumar Sunkara
1bd902370a
Add tests for mut_arg on help and version
2021-02-07 15:54:24 +00:00
Donough Liu
6968f340c3
Fix clippy warnings
2021-01-19 02:24:58 +08:00
David Yamnitsky
09014258cb
Use clap
instead of ::clap
in clap_derive
2020-12-15 15:20:21 -05:00
Aaron Hill
6dc8353fe2
Fix hygiene of arg_matches
parameter
...
In the `Clap` derive macro, a function parameter named `arg_matches` is
generated using `quote!` - as a result, this parameter ends up with
call-site hygiene. However, `arg_matches` is written literally within
several `quote_spanned!` blocks, which generate an `arg_matches` token
with the hygiene of whatever span was passed to `quote_spanned!`.
If these two hygienes are different (for example, if the user invokes
the derive macro from a `macro_rules!` macro), then a usage of
`arg_matches` may not resolve to the `arg_matches` parameter definition.
This commit changes the generation of `arg_matches` identifiers to
always use `quote!`, ensuring that they will always be considered the
'same' identifier by Rust.
2020-11-28 12:22:57 -05:00
Pavan Kumar Sunkara
56aeb155e1
Test rust regression
2020-11-28 11:47:18 +00:00
Luca Barbato
3e51839383
Rename the update trait methods
2020-11-14 10:58:30 +01:00
Luca Barbato
ac3e5f9a8f
Factor out argument parsing generation
2020-11-14 10:53:13 +01:00
Luca Barbato
7a5c12e79a
Avoid a level of indirection for augment_*subcommand
2020-11-14 10:17:13 +01:00
Luca Barbato
77e4e65e31
Address new clippy lints
2020-11-14 10:17:13 +01:00
Luca Barbato
5d342a7438
Update to the new from_subcommand logic
2020-11-14 10:17:13 +01:00
Luca Barbato
a9276576d7
wip: Add a variant for augment* for updates
2020-11-14 10:17:13 +01:00
Luca Barbato
8b6255057d
wip: Complete update_subcommand
...
external subcommand updating is equivalent to replace it
2020-11-14 10:17:13 +01:00
Luca Barbato
d1fc83a8fa
wip: Add update_from_arg_matches to FromArgMatches
2020-11-14 10:17:13 +01:00
Wim Looman
b31df047b8
Attach validation error as Error::source
2020-10-13 22:13:04 +02:00
Pavan Kumar Sunkara
b931e25c79
Update MSRV to 1.42
2020-10-09 17:04:46 +02:00
CreepySkeleton
a951958748
Allow flatten with doc comments
2020-08-25 20:20:56 +03:00
aspen
96b7fd454b
Forbid all unsafe code.
2020-08-20 18:38:40 -04:00
Kevin K
609202e2a0
wip: clap_derive docs
2020-08-11 15:21:57 +02:00
CreepySkeleton
f0044d205d
Remove a redundant lifetime
2020-08-05 22:33:51 +03:00
CreepySkeleton
e6cc49ecde
Adjust derive
2020-08-05 17:07:13 +03:00
Aaron Hill
c837b28552
fix(clap_derive): Unwrap syn::TypeGroup
when checking field types
...
Due to macro expansions, a `syn` type may be wrapped in multiple
'layers' of `syn::Type::Group`. However, `clap_derive` currently does
not check for `syn::Type::Group`, which will cause an `Option` (along
with other matched types) to fail to be detected when it results from a
macro expansion.
This commit 'unwraps' outer type groups before checking the
user-provided types against well-known types. Currently, these groups
may not be present due to a rustc bug (rust-lang/rust#43081 )
However, once https://github.com/rust-lang/rust/pull/73084 is merged,
these groups will be present in more cases. This commit makes `clap`
compatible with both older and newer versions of rustc.
2020-06-29 11:25:55 -04:00
bors[bot]
ca27d50ab2
Merge #1975
...
1975: fix: Use character instead of string for Arg::Short r=CreepySkeleton a=lanesawyer
Co-authored-by: Lane Sawyer <github@lanesawyer.dev>
2020-06-27 01:14:20 +00:00
Luca Barbato
081f3e865c
Fix the external command subtype check
2020-06-25 13:52:14 +02:00
Lane Sawyer
392effe319
fix: Use character instead of string for Arg::Short
...
This PR switches the Arg::Short macro to take a character instead of a string. It removes the hacky code in the Method to_token method and implements the logic for Short when parsing the clap derive arguments.
Fixes #1815 .
2020-06-17 09:45:05 -07:00
Andreas Steding
f3a9975085
fix: cargo fmt + clippy
2020-06-08 18:40:11 +02:00
Pavan Kumar Sunkara
fe52d77f4e
Allow separate derives, but do not give examples
2020-05-15 09:51:42 +02:00
Pavan Kumar Sunkara
7bc282dd4e
Rename with_name to new for Arg & ArgGroup
2020-05-14 22:50:56 +02:00
bors[bot]
99e862945e
Merge #1883
...
1883: External subcommand r=pksunkara a=CreepySkeleton
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-05-01 17:59:32 +00:00
CreepySkeleton
a21372e9ed
Fix ui tests
2020-05-01 20:09:55 +03:00
CreepySkeleton
ec6b6e1e36
Make validator take &str instead of String
2020-05-01 14:21:11 +03:00
CreepySkeleton
ee463ba834
Make extrernal_subcommand
ALMOST work
2020-04-30 20:20:21 +03:00
CreepySkeleton
3b418fe1a1
Cleaning
2020-04-30 15:11:39 +03:00
Pavan Kumar Sunkara
7616a5fa2e
Implemented arg_enum for option and vec
2020-04-28 11:35:47 +02:00
creativcoder
d0abb378b0
cargo fmt
2020-04-27 20:41:41 +05:30
creativcoder
9c8c06dd8c
Fix test for about method resolution in clap_derive
2020-04-27 02:42:07 +05:30
creativcoder
92d5920748
Updated test and usage of older help APIs with about
2020-04-27 02:42:07 +05:30
Pavan Kumar Sunkara
ea637b22eb
Apply suggestions from code review
...
Co-Authored-By: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-04-22 18:28:56 +02:00
Pavan Kumar Sunkara
c4c6c35da7
Added alias support for arg_enum
2020-04-22 14:38:09 +02:00
Pavan Kumar Sunkara
01c179f527
Added arg_enum support
2020-04-22 14:37:45 +02:00
Pavan Kumar Sunkara
c1ab22c3c9
Remove unneeded paths
2020-04-22 09:33:39 +02:00
CreepySkeleton
bfc850e99a
Suppress warnings in generated code
2020-03-05 11:35:21 +03:00
Pavan Kumar Sunkara
d8d29aea13
Remove every proc_macro_derive except Clap
2020-03-02 16:28:35 +01:00
Pavan Kumar Sunkara
0c22a9df6c
Added support for unit-struct
2020-03-02 11:46:40 +01:00
CreepySkeleton
3f314ce39e
Use full span information whenever possible
2020-02-13 21:47:42 +03:00
CreepySkeleton
9a15e47af0
Fix dummy implementations
2020-02-13 21:46:33 +03:00
CreepySkeleton
28ef1e91d4
Remove some mentioning of structopt
2020-02-13 18:29:51 +03:00
CreepySkeleton
ae574df2f9
Extract subcommands into separate trait
2020-02-12 23:15:05 +03:00
Pavan Kumar Sunkara
5b3a0dff9c
Remove extern & macro_use where possible
2020-02-07 07:34:01 +01:00
CreepySkeleton
8221c4f367
Get rid of #[clap(no_version)]
2020-02-05 16:54:58 +03:00
CreepySkeleton
1b2c4344cb
Fix visibility errors
2020-02-05 09:41:51 +03:00
David McNeil
62c4266daf
Fix verbatim_doc_comment on fields
...
Signed-off-by: David McNeil <mcneil.david2@gmail.com>
2020-02-05 09:35:21 +03:00
CreepySkeleton
c40eb88d5b
Less another one
2020-02-05 09:35:01 +03:00
CreepySkeleton
c7c7e5113c
One less hack
2020-02-05 09:34:23 +03:00
Cecile Tonglet
8f3eb4623e
Implemented: flatten on enums
...
Fixes #327
2020-02-05 09:10:59 +03:00
CreepySkeleton
596bdec856
Bugfix #324
...
Fixes https://github.com/TeXitoi/structopt/issues/324
2020-02-04 17:07:39 +03:00
CreepySkeleton
cf11d46373
Default value for default_value
(yeah, sounds awkward)
2020-02-04 11:40:01 +03:00
CreepySkeleton
5aafe9eaaf
Pre release tweaks and changelog
2020-02-04 11:10:47 +03:00
CreepySkeleton
3b11f9af25
Consistent doc comments ( #296 )
2020-02-03 18:20:08 +03:00
CreepySkeleton
0851fb0266
Introduce #[structopt(rename_all_env)]
2020-02-03 17:56:17 +03:00
Pavan Kumar Sunkara
dd75cee72c
fix: Clippy should pass
2020-02-01 06:48:50 +01:00
Pavan Kumar Sunkara
7e0d820aa6
Run clap_derive tests in CI
2020-01-18 19:04:11 +05:30
Pavan Kumar Sunkara
5e8f424dfe
Merged clap_derive using git-subtree
2020-01-18 17:40:07 +05:30