Commit graph

4097 commits

Author SHA1 Message Date
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
Michael Tang
cc592ed800 Add test for very large display_order values and a possible fix.
Fixes #2772
2021-09-16 19:11:30 -07:00
Pavan Kumar Sunkara
af7802a2ed
Merge pull request #2761 from ModProg/patch-1
doc(generate) fix link in `generate_to`
2021-09-09 16:35:12 +01:00
Roland Fredenhagen
c01df8da40
doc(generate) fix link in generate_to 2021-09-09 13:04:01 +02:00
Roland Fredenhagen
0105e6f0b8
fix(generate): Better subcommand completion in fish (#2726)
* fix(generate): Better subcommand completion in fish

* Prevent completing subcommands that were already completed

* Make sure all parent subcommands actually existent

Partially fixes #2715

* Added Test

* fix(generate) Improve subcommand testing

This now also disables the completion of sub_subcommands options for
subcommands.
2021-09-08 15:32:26 +01:00
Pavan Kumar Sunkara
d03638c0fd
Merge pull request #2751 from co42/derive_subcmd_name_not_literal
Allow subcmd name to be something else than a literal in clap derive
2021-09-07 08:40:54 +01:00
corentin.regal
8df90fbd0e Allow subcmd name to be something else than a literal in clap derive 2021-09-06 09:13:20 +02:00
patrick-gu
044f9c5669
Don't suggest help or --help when not applicable (#2749)
* Don't suggest `help` or `--help` when not applicable

* Apply suggestions from code review

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>

* Update test usage to match intended

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2021-09-04 20:10:24 +00:00
Pavan Kumar Sunkara
b8ceab3e6f Fixes #2736 2021-09-04 15:04:09 +05:30
Pavan Kumar Sunkara
dae86f456e
Merge pull request #2744 from dylni/replace-arg-str-with-raw-os-str
Replace `ArgStr` with `os_str_bytes::RawOsStr`
2021-08-31 21:19:02 +01:00
Emmanuel Leblond
15b9ff1a24
Add placeholders for Cookbook and Cheatsheet pages in the website (#2732)
* Add placeholders for Cookbook and Cheatsheet pages in the website

* Update site/content/cheatsheet.md

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2021-08-31 11:13:21 +00:00
Pavan Kumar Sunkara
09ec8bd1db
Merge pull request #2747 from svenstaro/fix-keyvalue-example
Fix keyvalue example
2021-08-30 05:00:02 +01:00
Sven-Hendrik Haase
2f8f55e64b
Fix keyvalue example
This was broken earlier due to 3f94d17c71 not
taking into account this example.

Fixes #2746.
2021-08-30 04:52:35 +02:00
dylni
6311c894cc Fix compile errors 2021-08-29 10:24:56 -04:00
dylni
a50591b16b Fix warnings 2021-08-29 10:10:26 -04:00
dylni
dc65513966 Replace ArgStr with os_str_bytes::RawOsStr 2021-08-29 10:00:30 -04:00
Pavan Kumar Sunkara
ee67039c5e
Merge pull request #2743 from ldm0/error_send_sync
Make `clap::Error` `Send` and `Sync` again
2021-08-29 11:29:19 +01:00
liudingming
898894cf35 Make clap::Error Send and Sync again 2021-08-29 17:21:08 +08:00
liudingming
f200828045 Add regression test 2021-08-29 17:21:08 +08:00
Pavan Kumar Sunkara
d0fd6df6d2
Merge pull request #2730 from ModProg/fish-argenum-hide-description
fix(generate): Hide option/argument description for argenum
2021-08-25 16:48:27 +01:00
ModProg
f6ccf07de4 Fix Formatting 2021-08-21 01:00:51 +02:00
ModProg
174e004107 fix(generate): Hide option/argument description for argenum
This returns `"{a\t,b\t}"` instead of `"a b"` for possible_values
completion. Therefore fish displays and therefor hides the empty
description after the `\t`.

Fixes #2727
2021-08-21 00:53:10 +02:00
Pavan Kumar Sunkara
f085fa64f4
Merge pull request #2722 from epage/group
fix(yaml): Don't panic on multiple groups
2021-08-19 07:40:41 +01:00
Pavan Kumar Sunkara
6512950e13
Merge pull request #2677 from epage/utf8
fix: Provide path to avoid UTF-8 panics
2021-08-18 22:50:42 +01:00
Ed Page
bd25b5f615 fix(yaml): Don't panic on multiple groups
Because we gradually build the `ArgGroup` as we parse the YAML, we don't
use `ArgGroup::new`.  Clap3 introduced an internal `id` in addition to
the public `name` and it appears that this custom initialization code
was not updated.

This shows the problem with publically exposing `impl Default`.
Choices:
- Remove `impl Default`
  - Always valid
  - Requires spreading invariants
  - Callers can't implement code the same way we do
- Add `ArgGroup::name`
  - Can be constructed in an invalid state
  - Centralizes invariants
  - A caller could implement code like the yaml logic

I decided to go with `ArgGroup::name`.

Fixes #2719
2021-08-18 15:16:44 -05:00
Ed Page
aeaf01e3e7 fix: Provide path to avoid UTF-8 panics
Before, validating UTF-8 was all-or-nothing and would cause a `panic` if
someone used the right API with non-UTF-8 input.

Now, all arguments are validated for UTF-8, unless opted-out.  This
ensures a non-panicing path forward at the cost of people using the
builder API that previously did `value_of_os` need to now set this flag.

Fixes #751
2021-08-18 14:15:18 -05:00
Pavan Kumar Sunkara
2fd26423e2
Merge pull request #2720 from epage/generate
docs(generate): Improve jumping off points
2021-08-18 19:51:35 +01:00
Ed Page
f2586c920f docs: Point out alternatives to 'build.rs' 2021-08-18 12:10:04 -05:00
Ed Page
13a93ab671 docs(generate): Improve jumping off points
This provides a skeleton README for `clap_generate`, including a
one-line summary and a link to the docs to guide people to the examples
there.

In doing so, I tried to clarify and be consistent in what role
this crate plays.  While it is very general, being too general in the
description can lead people to not understand where they could use it.

Fixes #1711
2021-08-18 12:10:04 -05:00
Pavan Kumar Sunkara
d7711626bd
Merge pull request #2716 from epage/broken
fix: Swallow broken pipes
2021-08-18 17:51:02 +01:00
Ed Page
329fe4a24b fix: Swallow broken pipes
Previously, we paniced.  This is one less reason people have to call
lower level `get_matches` to get the commonly expected behavior, making
it more likely for the Rust community to "do the right thing"

Fixes #2659
2021-08-18 10:16:57 -05:00
Pavan Kumar Sunkara
a4137d639a
Merge pull request #2713 from epage/warn
fix(derive): Don't produce warnings
2021-08-18 09:50:13 +01:00
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