Repository navigation
feat(spec): bind a default when another flag is given - #1023
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 |
Instruction counts
No instruction-count regression above 1%. 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
|
Add default_if on the target flag, first-match-wins, matching clap's default_value_if. Two arguments are IsPresent; three are Equals. Env is applied to every flag first so a sibling env can activate the condition; argv and env on the target suppress it. An applied default_if is a default: it satisfies requires and does not activate requires_if. Co-authored-by: jeff <jeff@jdx.dev>
ApplyDefaultIf always passed negated=false into RelationshipValues, so an Equals condition of "false" never matched --no-json. Thread the parser's negation map through, the same way requires_if already does. Co-authored-by: jeff <jeff@jdx.dev>
Equals for a bool accepted 1/True/0/False, while requires_if and usage-lib's argv path only compare canonical true/false. Tighten so the same KDL binds in every implementation. Co-authored-by: jeff <jeff@jdx.dev>
e7f5779 to
c3bd092
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c3bd092. Configure here.
CI lint uses --all-targets. The Equals default_if fixture never asserted `output`, and the new parse tests used get().is_none() where contains_key is the form clippy wants. Co-authored-by: jeff <jeff@jdx.dev>
Decide every default_if against argv and env first, then bind, then apply unconditional defaults. Binding as we went put a default into out.flags so the next flag treated it as explicit. Go Given() and the derive __given_* flags already ignore defaults here. Co-authored-by: jeff <jeff@jdx.dev>
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> `external_subcommand` (#1021) and `default_if` (#1023) are in the parser, the derive, and the corpus. PLAN.md still listed them as open clap gaps. This ticks those items, drops them from the fleet table, and splits `multicall` from `no_binary_name` so the next PR can close one without pretending the other landed. `no_binary_name` stays out of scope until a fleet CLI needs it. Also stops quoting a corpus vector count in PLAN.md and `go/README.md`, matching the argv grammar page (#1024): agreement is measured on each run rather than asserted as "154". Stacked next: #1028 (`multicall`). _This comment was generated by Claude Code._ <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-4de7e59e-aa2e-4ad0-a1d0-1c2e69c166db?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-4de7e59e-aa2e-4ad0-a1d0-1c2e69c166db&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added BusyBox-style multicall support, selecting subcommands from the executable name. * Added support for paths, Windows `.exe` suffixes, dispatcher names, symlink-style invocations, and external subcommands. * Added aliases, hidden choices, and optional case-insensitive value matching. * Added multicall configuration across supported integrations and generated specifications. * **Bug Fixes** * Added validation for invalid multicall configurations and clearer unknown-applet behavior. * **Documentation** * Documented multicall behavior, value choices, supported invocation patterns, and conformance status. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>

Stacked on #1021 (
external_subcommand). Adds clap'sdefault_value_if/default_value_ifsasdefault_ifon the target flag.Semantics
ArgPredicate::IsPresent; three areEquals.default_if, so a sibling env can activate the condition regardless of declaration order.default_ifis a default: it satisfiesrequiresand does not activaterequires_if."false"(--no-json), matchingrequires_if.default_ifempty (same hole asrequires).Surfaces
default_if/default_ifs) and usage-argvFlagMetaMeta.DefaultIf,Fill(skips unconditional default whenDefaultIfis set),ApplyDefaultIf(takes the parser's negation map)11-default-if.json(layer: "post-binding")value_parserranges remain deferred. Multicall is the next stacked PR.