Commit graph

4344 commits

Author SHA1 Message Date
Ed Page
29a6a854f1 fix(ci): Don't have PRs canceling each others jobs
Using `head_ref`, we are making it so PRs are all in the same group.
When a new PR comes in (not just an update), it then cancels all other
PRs.  Switching to `ref` makes it so each PR is in its own concurrency
group.
2021-10-06 19:16:55 -05:00
Ed Page
6594e28776
Merge pull request #2826 from epage/skip
feat(derive): Add skip attribute support for enum variants
2021-10-06 19:16:42 -05:00
Ed Page
64e9ecf79b
Merge pull request #2825 from epage/map
fix(derive): Fix the problem where the build fails due to the ambigous type of `map`
2021-10-06 19:16:27 -05:00
grant0417
f3611ad6b9 feat(generate): Add fig autocomplete generator 2021-10-06 19:42:42 -04:00
Ed Page
16023cf157 feat(derive): Add skip attribute support for enum variants
> Resolves #493

This is a port of https://github.com/TeXitoi/structopt/pull/494

This is part of #2809
2021-10-06 13:52:02 -05:00
Ed Page
51c723a84f fix(derive): Fix the problem where the build fails due to the ambiguous type of map
> This PR closes #490. Please refer to #490 for the detail of the problem. Let me know if you want to make `convert_type` a function.

This is a port of https://github.com/TeXitoi/structopt/pull/491

This is part of #2809
2021-10-06 13:22:56 -05:00
Ed Page
5512c90380
Merge pull request #2818 from epage/docs-panic
docs: Point people to common panic practices
2021-10-06 08:55:47 -05:00
Ed Page
e62a92f260
Merge pull request #2810 from epage/license
docs: Ensure all crates have license files
2021-10-06 08:55:25 -05:00
Ed Page
6f95650a91
Merge pull request #2805 from epage/validate_default
fix(derive): Type check `default_value_t`
2021-10-06 08:54:59 -05:00
Ed Page
6fd3e0b834
Merge pull request #2820 from epage/option
fix(derive): Support SubcommandsNegateReqs
2021-10-05 19:10:01 -05:00
Ed Page
a77e12e030 docs: Point people to common panic practices 2021-10-05 18:35:46 -05:00
Ed Page
9afa08ff50 fix(derive): Support SubcommandsNegateReqs
Before there was no way to make `SubcommandsNegateReqs` with
`clap_derive` because it required a required field with a sentinel value
for when the required part was negated.  We blocked that.

This turned out simpler than I expected.

This came out of the discussion for #2255 but that issue is more
specifically about the panic, so not closing it.
2021-10-05 16:02:02 -05:00
Ed Page
6c6b97daa8 docs: Ensure all crates have license files
In #2270, its brought up to solve this at the `cargo workspace publish`
level.  However, copying the files is a 5s fix without any design work,
it doesn't seem like support within an external tool should block us
from getting this fix into users hands.  Once `cargo workspace publish`
supports this and if we are still using it, we can re-evaluate.

Fixes #2270
2021-10-04 14:45:31 -05:00
Ed Page
62eff1f8d3
Merge pull request #2804 from epage/multiple
fix(parser): Allow multiple_occurrecnes with positional args
2021-10-04 13:57:33 -05:00
Ed Page
d0b22b53ff fix(derive): Type check default_value_t
Fixes #2064
2021-10-04 13:02:47 -05:00
Ed Page
8e780e364d fix(parser): Allow multiple_occurrecnes with positional args
This unblocks
- Defining repeated tuples in positional arguments
- Potentially using this in #1772

Fixes #2784
2021-10-04 12:09:54 -05:00
patrick-gu
edd0124af0
Fix disabling the default help and version subcommands/flags (#2796)
* Check for `DisableHelpFlag` along with `NoAutoHelp`

Also applies for `DisableHelpSubcommand` and `DisableVersionFlag` with `NoAutoVersion`

* Add tests for overriding help and version, and disabling version.

These override by disabling the default and adding a new one.

* Don't use `default_missing_value` for `override_version_using_short`

* Check errors by the API.

This changes the `disabled_version_long` and `disabled_version_short` tests.

This is opposed to comparing the stderr output.
2021-10-04 15:01:09 +01:00
Ed Page
236cf584cf
Merge pull request #2800 from ModProg/ArgValue-derive
Rename `ArgEnum::arg_value` to `to_arg_value`
2021-10-01 10:27:00 -05:00
ModProg
08e8c53862 refactor(ArgEnum): replace unwrap with except, arg_value -> to_arg_value 2021-10-01 16:14:10 +02:00
Ed Page
3b2e3ffddf
Merge pull request #2762 from ModProg/ArgValue-derive
ArgValue derive
2021-10-01 08:43:40 -05:00
ModProg
47ff3ed945 documentation for ArgValue 2021-09-29 20:55:47 +02:00
ModProg
d53778ed5d fix ui 2021-09-29 19:31:05 +02:00
ModProg
15fcf814c2 fix dummies 2021-09-29 19:05:16 +02:00
ModProg
480035ac9c ArgEnum: Slice instead of array, from_str in ArgEnum implemented 2021-09-29 18:33:43 +02:00
Pavan Kumar Sunkara
5940bb2360
Merge pull request #2794 from ldm0/simplify
Less format & branch
2021-09-28 22:21:09 +01:00
ModProg
ac1a9d6d13 address epage's remarks 2021-09-27 22:06:17 +02:00
liudingming
3206db99af less format macro, less branches. 2021-09-27 23:34:13 +08:00
ModProg
76f7211d8b small changes 2021-09-27 01:29:10 +02:00
ModProg
f002cdcc99 move alias implementation to ArgValue for derive 2021-09-27 01:18:47 +02:00
ModProg
d3f0534939 add hidden aliases to ArgValue 2021-09-26 22:46:23 +02:00
Pavan Kumar Sunkara
a9bd06945a
Merge pull request #2793 from ldm0/master
Resolve a todo
2021-09-26 21:04:09 +01:00
liudingming
7ba46400e4 Resolve a todo 2021-09-27 02:03:28 +08:00
Roland Fredenhagen
88d7d02555 Working Implementation 2021-09-26 16:32:46 +02:00
ModProg
b589a6ce06 feat(derive:arg_enum): use ArgValue in ArgEnum trait 2021-09-26 16:32:46 +02:00
Pavan Kumar Sunkara
86fda8bacd
Merge pull request #2786 from jonathanmorley/assert-whitespace
assert on leading and trailing whitespace
2021-09-24 20:25:17 +01:00
Morley, Jonathan
1d3a292d6b assert on leading and trailing whitespace 2021-09-24 12:38:15 -04:00
Pavan Kumar Sunkara
f243bbf06d
Merge pull request #2781 from clap-rs/settings_bitor
Implement BitOr for settings
2021-09-24 16:14:51 +01:00
Pavan Kumar Sunkara
9c214a66dc
Merge pull request #2783 from cherryblossom000/elvish-completions-fix
Fix Elvish completions generation
2021-09-24 14:39:00 +01:00
cherryblossom
f77dceaf69
Fix Elvish completions generation
The `display-suffix` option for `edit:complex-candidate` was [deprecated in Elvish v0.14.0][1] and
removed in v0.15.0 (latest version is v0.16.3), so this commit changes the Elvish completions
generation to use the `display` option instead.

Additionally, this commit changes assignments to use the `var` and `set` keywords as using
`name = value` without these keywords ('legacy assignment form') [will be deprecated][2].

[1]: https://elv.sh/blog/0.14.0-release-notes.html
[2]: https://elv.sh/ref/language.html#legacy-assignment-form
2021-09-24 22:29:05 +10:00
Pavan Kumar Sunkara
bdc70c9fd9 Fix benchmarking issues 2021-09-23 17:17:15 +05:30
Pavan Kumar Sunkara
699a3f76d6 Implement BitOr for settings 2021-09-23 14:57:10 +05:30
Roland Fredenhagen
5580e8c465
ArgValue builder (#2758)
* feat(arg_value): ArgValue can be used for possible_values

Through the ArgValue it is possible:

* `hide` possible_values from showing in completion, help and validation
* add `about` to possible_values in completion

* Resolved a few change-requests by epage

* make clippy happy

* add ArgValue::get_visible_value

* remove verbose destructering

* rename ArgValue::get_hidden to ArgValue::is_hidden

* add test for help output of hidden ArgValues

* Documentation for ArgValue

There is an issue that required to implement From<&ArgValue> for
ArgValue. We should probably find a solution without that.

* fix requested changes by epage

* fix formatting

* add deref in possible_values call to remove From<&&str>

* make clippy happy

* use copied() instad of map(|v|*v)

* Finishing up for merge, hopefully

* changes requested by pksunkara
2021-09-19 10:29:09 +00:00
Pavan Kumar Sunkara
a42a97a566
Merge pull request #2775 from patrick-gu/master
Apply `value_delimiter` to default values
2021-09-19 00:55:39 +01:00
patrick-gu
d79c59ab17 Add test for default_missing_values with value_delimiter 2021-09-18 15:47:03 -07:00
patrick-gu
90dde89ec4 Apply value_delimiter to default values 2021-09-18 15:15:25 -07:00
Pavan Kumar Sunkara
c4780e3305
Merge pull request #2774 from epage/vec_map
refactor: Remove vec_map dependency
2021-09-18 11:38:46 +01:00
Ed Page
b3847b76c4 refactor: Remove vec_map dependency
Doesn't look like this dependency is buying us anything at this point,
so removing it.
2021-09-17 15:14:49 -05:00
Pavan Kumar Sunkara
76859b16bb
Merge pull request #2773 from tangmi/fix-large-display-order
Add test for very large display_order values and a possible fix
2021-09-17 19:39:37 +01:00
Pavan Kumar Sunkara
1937472e0f
Merge pull request #2771 from mustafa-guler/master
Fix bug with duplicate error messages
2021-09-17 19:28:43 +01:00
Mustafa Guler
50b9e65d39 Fix bug with duplicate error messages
This addresses a bug that causes duplicate flags reported in user-facing
error messages when two flags require one-another but also are required
under other conditions. The fix involves removing duplicates in unrolled
requirements, which addresses the user-facing aspect of this bug.
2021-09-17 10:47:06 -04:00