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.
* 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.
* 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>
* 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>
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
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
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
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
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
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