Commit graph

3963 commits

Author SHA1 Message Date
Ed Page
502dd78828 fix(derive): Don't produce warnings
I did some digging to root cause this but gave up and suppressed it,
like others.  Warnings like this also come with a cost of code-gen
complexity.

Fixes #2712
2021-08-17 20:53:12 -05:00
Donough Liu
0394ae6102
Fix handling of number_of_values when displaying arg (#2701)
* Remove dead logic

* Outline common logic

* Fix issue 1571
2021-08-17 09:17:18 +00:00
Donough Liu
b1d364a228
Pin clap_derive version (#2706)
* Pin clap_derive version

* Pin clap version in clap_generate
2021-08-17 08:43:37 +00:00
Pavan Kumar Sunkara
9d5cf64d6a
Merge pull request #2704 from jrheard/patch-1
fix typo
2021-08-16 10:45:33 +01:00
Pavan Kumar Sunkara
257adbc882
Merge pull request #2703 from clap-rs/hide_env
Remove TakesValue restriction for HideEnv*
2021-08-16 10:45:08 +01:00
JR Heard
465d495b6d
fix typo 2021-08-15 20:02:18 -07:00
Pavan Kumar Sunkara
9dd75987df Remove TakesValue restriction for HideEnv* 2021-08-15 19:40:24 +01:00
Pavan Kumar Sunkara
52be134949 Release 3.0.0-beta.4
clap@3.0.0-beta.4
clap_derive@3.0.0-beta.4
clap_generate@3.0.0-beta.4

Generated by cargo-workspaces
2021-08-14 23:40:49 +01:00
Pavan Kumar Sunkara
b1752226e2 Fix error 2021-08-14 23:10:05 +01:00
Pavan Kumar Sunkara
73b28fb104 Release 3.0.0-beta.3
clap@3.0.0-beta.3
clap_derive@3.0.0-beta.3
clap_generate@3.0.0-beta.3

Generated by cargo-workspaces
2021-08-14 23:01:13 +01:00
Pavan Kumar Sunkara
a9b86ecefc Update changelog 2021-08-14 22:46:49 +01:00
Pavan Kumar Sunkara
c15b894e80
Merge pull request #2700 from TheDaemoness/patch-1
Fix invalid_value returning an Error with no info
2021-08-14 22:22:56 +01:00
TheDaemoness
f411a65d82
Fix invalid_value returning an Error with no info 2021-08-14 11:28:51 -07:00
Pavan Kumar Sunkara
203613d5e3
Merge pull request #2696 from ldm0/override
Make `overrides_with` working when `MultipleValues` is enabled.
2021-08-14 10:41:40 +01:00
liudingming
a85857dfb0 Make overrides_with working when MultipleValues is enabled. 2021-08-14 16:34:26 +08:00
Pavan Kumar Sunkara
441ff68c2d
Merge pull request #2694 from clap-rs/env-feature
Add env feature gate
2021-08-14 03:11:21 +01:00
Pavan Kumar Sunkara
52d064be82
Merge pull request #2693 from clap-rs/value_names
`num_vals` is now constructed from `val_names` in only one place instead of two
2021-08-14 02:44:49 +01:00
Pavan Kumar Sunkara
c7985fb73e Add env feature gate 2021-08-14 01:55:05 +01:00
Pavan Kumar Sunkara
61eb921f63 Fix value_names & num_vals interaction 2021-08-14 01:08:44 +01:00
Pavan Kumar Sunkara
09257a8961
Merge pull request #2690 from epage/value_name
fix!: value_name/value_names should not append
2021-08-13 22:45:59 +01:00
Ed Page
2eb22e2b36 fix!: value_name/value_names should not append
Instead they should behave like `default_value`/`default_values`.

In implementingt this, I didn't see any reason to be using a `VecMap`.
In fact, this helped simplify the code / make intent clearer.

With this, we are also able to simplify the derive macro work from #2633.

Fixes #2634

BREAKING CHANGE: `value_name`/`value_names` always overwrite, rather
than append.  We expect the impact to be minimal.
2021-08-13 15:37:03 -05:00
Pavan Kumar Sunkara
24bfd2b92c Fix test errors 2021-08-13 20:58:38 +01:00
Pavan Kumar Sunkara
d64ced0311
Merge pull request #2686 from ldm0/delimiter
Make `value_delimiter` accept `char` rather than `String`
2021-08-13 20:53:21 +01:00
Pavan Kumar Sunkara
3d2635b9b0
Merge pull request #2685 from ldm0/doc
Tweak `ArgsNegateSubcommands`'s doc
2021-08-13 20:52:41 +01:00
Pavan Kumar Sunkara
badcb3ac7b
Merge pull request #2684 from epage/update_ext
test: Cover external subcommand updates
2021-08-13 20:51:21 +01:00
liudingming
a60836d96a Make value_delimiter accept char rather than String 2021-08-14 02:54:56 +08:00
Pavan Kumar Sunkara
446c28fb03
Merge pull request #2635 from epage/default_value_t
feat(derive): Specify defaults by native expressions
2021-08-13 19:36:33 +01:00
liudingming
a8060d305b Tweaks ArgsNegateSubcommands's doc 2021-08-14 02:30:27 +08:00
Ed Page
2458d3934a test: Cover external subcommand updates
We don't know enough to do partial updates, so we are only doing full
updates.

Closes #2212
2021-08-13 12:33:12 -05:00
Ed Page
9a180c1511 feat(derive): Specify defaults by native expressions
Right now
- `default_value="something"` is a raw method
- `default_value` uses native types

This commit splits the meanings
- `default_value="something"` is a raw method
- `default_value_t` uses `T::default()`
- `default_value_t=expr` uses an expression that evaluates to `T`

This is meant to mirror the `value_of` / `value_of_t` API.

At the moment, this is limited to `T: Display` to work with clap's
default system.  Something we can look at in the future is a way to
loosen that restriction.  One quick win is to specialize when `arg_enum`
is set.  The main downside is complicating the processing of attributes
because it then means we need some processed before others.

Since this builds on `clap`s existing default system, this also means
users do not get any performance gains out of using `default_value_t`,
since we still need to parse it but we also need to convert it to a
string.

Fixes #1694
2021-08-13 12:20:54 -05:00
Pavan Kumar Sunkara
476dd190b7
Merge pull request #2682 from clap-rs/checker
Set TakesValue to true for positional args when building
2021-08-12 22:46:15 +01:00
Pavan Kumar Sunkara
550e73d056
Merge pull request #2531 from pickfire/fix-flatten
Derive doc clap ordering for multiple Clap
2021-08-12 21:34:49 +01:00
Pavan Kumar Sunkara
8f2ba607aa
Merge pull request #2534 from stevenengler/hide-heading
Hide help heading when all args are hidden
2021-08-12 21:32:07 +01:00
Pavan Kumar Sunkara
b4a662b6c9 Set TakesValue to true for positional args when building 2021-08-12 21:27:42 +01:00
Steven Engler
1bd63feffe Hide help heading when all args are hidden 2021-08-12 00:51:58 +01:00
Pavan Kumar Sunkara
33c305ea6f
Merge pull request #2681 from clap-rs/global-setting
Remove settings that are inherently global
2021-08-12 00:26:47 +01:00
Ivan Tham
f484e2da11 Derive doc clap ordering for multiple Clap
Fix #2527
2021-08-11 23:31:00 +01:00
Pavan Kumar Sunkara
6ae15a79b6 Remove settings that are inherently global 2021-08-11 22:41:25 +01:00
Pavan Kumar Sunkara
69d75949df
Merge pull request #2664 from rami3l/env-literal
feat(parser): accept boolean literal with env vars
2021-08-10 23:44:19 +01:00
rami3l
5a965caf1e feat(parser): accept non-false literals with env vars as true, take 2 2021-08-10 19:13:43 +02:00
rami3l
5f781c72a5 feat(parser): accept non-false literals with env vars as true 2021-08-10 12:21:12 +02:00
rami3l
d32b6bf764 fix(test): fix doc test 2021-08-10 12:21:12 +02:00
rami3l
f2f9b665ed feat(parser): accept boolean literal with env vars, take 1 2021-08-10 12:21:02 +02:00
Pavan Kumar Sunkara
6527fdeec4
Merge pull request #2671 from ldm0/tmp
Fix some work on `ArgStr`
2021-08-09 00:41:51 +01:00
liudingming
696f93c4f5 Fix some work on ArgStr 2021-08-09 04:26:01 +08:00
Pavan Kumar Sunkara
eabe828092
Merge pull request #2655 from ldm0/coverage
Parser refactor
2021-08-08 20:56:09 +01:00
liudingming
5f70e38c2a Optimize ArgStr 2021-08-09 02:22:31 +08:00
liudingming
216aab2479 Remove TrailingValues from app settings 2021-08-08 03:41:23 +08:00
liudingming
963aa1977d Remove ValidArgFound from app settings 2021-08-08 03:41:23 +08:00
liudingming
e851a82080 Move pos_counter before parsing flags.
Then checking if AllowHyphenValues is set when parsing flag is possible.
2021-08-08 03:38:41 +08:00