clap/tests/fixtures/multiple_groups.yaml
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

21 lines
244 B
YAML

name: app
args:
- arg_1:
short: a
- arg_2:
short: b
- arg_3:
short: c
- arg_4:
short: d
groups:
- group_1:
args:
- arg_1
- arg_2
- group_2:
args:
- arg_3
- arg_4