feat(derive): support clap implicit groups - #1137
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
1065776 to
b8992fb
Compare
Instruction counts
1 benchmark(s) above the 1% gate: Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes. Shadow comparisonParsing
|
b8992fb to
41d459e
Compare
41d459e to
76343ae
Compare
|
Addressed both new implicit-group findings in this PR:
The facade regression covers split attributes, dual membership, requiredness, and exclusivity. This comment was generated by Codex. |
76343ae to
b53525b
Compare
c44c296 to
ed320f1
Compare
ed320f1 to
8b899b8
Compare
8b899b8 to
9268df9
Compare
9268df9 to
203b9d5
Compare
2d6d79c to
49a59e0
Compare
aaaba60 to
cb87cb8
Compare
cb87cb8 to
310e63f
Compare
514dcb5 to
0d5d290
Compare
0d5d290 to
cd05d2c
Compare
d7d71f0 to
a8c98b9
Compare
a8c98b9 to
58f1c86
Compare
58f1c86 to
0eef7e0
Compare
0eef7e0 to
0f88e21
Compare
8fa7de7 to
b0516d3
Compare
b0516d3 to
2fdaff5
Compare
Summary
#[group(...)]helper attributeArgsfields into the derived implicit groupmultiple(true)and explicit required/multiple/skip settingsVerification
cargo test -p usage-rs --test facade clap_implicit_groups_apply_to_the_args_struct_fieldscargo clippy -p usage-derive --all-targets --all-features -- -D warningsThis pull request was generated by Codex.
Note
Medium Risk
Touches derive parsing and how required flags/groups are encoded in generated parsers and specs. Wrong mapping would change CLI validation and portable KDL, but behavior is covered by facade tests.
Overview
Adds clap-compatible struct-level
#[group(...)]onCli/Argsderives so anArgsstruct’s direct flags and positionals form an implicit group (clap defaults:multiple(true), optionalrequired/id/skip).Membership is joined from both field
group = "..."and implicit group member lists. One-member required implicit groups do not emit a spec group; they lower onto the field as ordinary requiredness (metadata, help, and runtimeMissingRequired). Multi-member implicit groups that only restated clap’s defaultmultiplewithoutrequiredare omitted from emitted group metadata.Reviewed by Cursor Bugbot for commit bc00e65. Bugbot is set up for automated code reviews on this repo. Configure here.