fix: accept -C/--repo-dir and --minimal-dir after the subcommand - #1042
Conversation
repo_dir (-C/--repo-dir) and minimal_dir (--minimal-dir) were the only GlobalArgs fields with a bare #[arg(long)]; every other field carries global = true. Without it, clap rejected both flags when they appeared after a subcommand (exit 2), which also broke complete-session-str's documented promise to honour --minimal-dir. Add global = true to both, matching config_dir, provider, and no_input, and pin the post-subcommand acceptance with a parse test. Closes: #1039
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 11 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Comment |
main gained a `session destroy` parse test at the same spot in the test module as this branch's post-subcommand test, so the two additions collided textually. Both tests are kept; they assert unrelated things. The `global = true` additions on `repo_dir`/`minimal_dir` merged cleanly and are unaffected by main's help-text and subcommand restructuring.
Fixes #1039
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABKmgfYg
repo_dir(-C/--repo-dir) andminimal_dir(--minimal-dir) were the onlyGlobalArgsfields with a bare#[arg(long)]; every other field carriesglobal = true. Without it clap rejected both flags after a subcommand (exit 2), which also brokecomplete-session-str's documented promise to honour--minimal-dir. Addingglobal = trueto both — matchingconfig_dir,provider, andno_input— fixes both positions, and a parse test pins post-subcommand acceptance. The docs list both as global flags, confirming intent (informed by the Minimal CLI Reference,docs/reference/cli.md). Scope note:mip'sGlobalArgscarries the same omission, but issue #1039 is entirely about theminCLI, so this patch leavesmipuntouched.Verification
cargo fmt --all --check --manifest-path target/Cargo.toml — clean, exit 0
cargo clippy --workspace --locked -- -D warnings — 0 warnings, exit 0 (finished in 10m45s)
cargo build --workspace --locked — finished, exit 0
cargo test --workspace --locked — all tests pass, exit 0 (incl. new repo_and_minimal_dir_are_accepted_after_the_subcommand)
Note
Accept
-C/--repo-dirand--minimal-dirflags after subcommandsMarks
repo_dirandminimal_dirinGlobalArgsasglobal = truein their clap#[arg(...)]attributes in lib.rs, so these flags are accepted on either side of a subcommand (e.g.min ls -C /tmp/x --minimal-dir /tmp/y). Previously they were only accepted before the subcommand.Macroscope summarized f44e9b8.