Commit graph

131 commits

Author SHA1 Message Date
Ed Page
f6fa3771a6 refactor(derive): Order args.rs by use 2021-07-14 15:55:31 -05:00
Ed Page
58dd1d5c5a refactor(derive): Move from_arg_matches into coupled derives 2021-07-14 15:55:03 -05:00
Pavan Kumar Sunkara
894be6799c
Merge pull request #2585 from epage/argenum
fix(derive): `Clap` should not derive `ArgEnum`
2021-07-14 18:01:31 +01:00
Ed Page
6cc76e7237 fix(derive): Clap should not derive ArgEnum
While having convinience derives can be helpful, deriving traits that
are not used in similar situations (`Clap` and `ArgEnum`) can make
things harder
- From a user, derives are opaque and create uncertainty on how to use
  the API if not kept crystal clear (deriving a name gives you the trait
  by that name)
- This makes documentation harder to write and read
- You can use types in unintended places, which is made worse for crate
  APIs because changing this breaks compatibility.

Fixes #2584
2021-07-14 10:50:26 -05:00
Tshepang Lekhonkhobe
b4eddf158d fix remaining intra-doc links 2021-07-10 21:00:34 +02:00
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
Pavan Kumar Sunkara
94ce18c399 Update badges 2021-05-25 23:19:32 +01:00
Felipe Sere
46cd4fe664 Run fmt 2021-05-19 19:43:06 +01:00
Felipe Sere
6bac0c53bf Rename flag parameter to not clash with subcommand 2021-05-19 19:42:39 +01:00
Felipe Sere
856de610a2 Create a separate test for from_global 2021-05-18 21:35:49 +01:00
Kat Marchán
814b56dccb feat(derive): Add support from inheriting global options in subcommands 2021-05-18 17:39:51 +01:00
Donough Liu
2a921d4cda Fix clippy warnings. 2021-05-07 19:05:18 +00:00
liudingming
4dfc900a99 Clippy fix 2021-05-07 15:20:03 +08:00
Pavan Kumar Sunkara
99d4aba95c Remove azure pipelines 2021-04-13 22:46:24 +01:00
Pavan Kumar Sunkara
3c9cc0cf91 Specify dep patch versions 2021-04-11 10:38:13 +01:00
Pavan Kumar Sunkara
4e3b4589ee
Merge pull request #2411 from clap-rs/upgrader
Cleanup and add changelog
2021-03-14 14:00:16 +05:30
Pavan Kumar Sunkara
d9fb11eba2 Apply cargo-intraconv 2021-03-13 14:11:47 +05:30
Pavan Kumar Sunkara
49954c28ad Remove unstable feature flag 2021-03-13 11:40:56 +05:30
Omar El Halabi
777e0f43cb fix: subcommand with field name subcmd compilation 2021-03-10 19:49:41 +02:00
ldm0
2b0f0d3e1a Implement NoEquals error 2021-03-09 17:56:57 +00:00
Logan SQUIREL
3c049b4e22
Fix compatibility with help2man output (see #1432)
Change default help template:
- The new template introduce new lines before and after
author/about sections.
- Add help template placeholders:
    - about-section
    - author-section
- Documentation of new placeholders in clap::App::help_template
- Update all unit tests by incorporating new lines
2021-02-27 16:20:52 +01: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
ldm0
a684e9a51d Bump version-sync version 2021-02-14 09:51:23 +00:00
ldm0
580d8d2c63 Fix part of the non_fmt_panic 2021-02-12 17:35:15 +00: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
Pavan Kumar Sunkara
ad9f97f402 Fix ui tests 2020-11-28 19:16:58 +00: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
d18ff58391 Add a skip test 2020-11-14 11:09:39 +01: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
9ebb46d65c Test for partial updates 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
646b3fe811 wip: Add tests and user-facing functions 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
Pavan Kumar Sunkara
d6e2246aab Rename setting DisableVersion => DisableVersionFlag 2020-10-24 16:03:12 +02:00
Wim Looman
b31df047b8 Attach validation error as Error::source 2020-10-13 22:13:04 +02:00
Marti Raudsepp
bc7cc4fbab Add examples for using value_hint with clap_derive
Also tweaked clap_generate example a little.
2020-10-10 00:11:44 +03:00
Pavan Kumar Sunkara
b931e25c79 Update MSRV to 1.42 2020-10-09 17:04:46 +02:00
Pavan Kumar Sunkara
d881a1185b Release 3.0.0-beta.2
clap@3.0.0-beta.2
clap_derive@3.0.0-beta.2
clap_generate@3.0.0-beta.2

Generated by cargo-workspaces
2020-09-18 20:32:41 +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