fix(cli): accept --flag=value and reordered options in pane read/wait-output - #2183
fix(cli): accept --flag=value and reordered options in pane read/wait-output#2183KyleCo76 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe CLI now supports ChangesPane argument parsing
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThe PR updates the hand-written
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/cli.rs | Adds a shared helper that expands recognized long-option assignments while preserving boolean and unknown options for rejection. |
| src/cli/pane.rs | Extracts pure argument parsers for pane read and wait-output, supporting reordered and equals-form options while preserving request defaults. |
| tests/cli/panes.rs | Verifies invalid values produce plain usage errors with exit code 2 before server contact. |
Reviews (2): Last reviewed commit: "fix(cli): accept --flag=value and reorde..." | Re-trigger Greptile
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 684731a2-0815-4d90-bd64-fa152da178b7
📒 Files selected for processing (3)
src/cli.rssrc/cli/pane.rstests/cli/panes.rs
bf2afe4 to
1a48ef8
Compare
|
Changes done for pane read — its generated help advertises both detection and --raw (read_source_option(true) + flag("raw") in spec.rs), so the fallback usage now lists both. Left wait-output unchanged: its help deliberately omits detection (read_source_option(false)), and the usage string mirrors the generated help. |
Problem
herdr pane read --helpandherdr pane wait-output --help(clap-generated)advertise
herdr pane read [OPTIONS] <PANE_ID>, but the hand-rolled parsersonly accept space-separated options after the pane id:
Failures are loud (exit 2), but the error can point at the wrong token, and
scripts written against
--helpor the usual--flag=valueconvention break.Fix
expand_equals_args(shared helper) splits--flag=valueinto two tokensfor value-taking options only; boolean and unknown options keep their
attached value and still reach the unknown-option branch.
parse_*_argsfunctions (same pattern asparse_pane_split_args) that accept the pane id positional in any order andreturn the schema params directly.
Unlike the worktree
--jsoncompatibility no-op removed from public help in#2174, these pane options already populate supported API fields and work in
the existing pane-id-first form; only the hand parser disagrees with the
generated syntax.
Previously valid invocations keep the same defaults and wire requests.
Invalid source/format/numeric values now print the underlying parser message
directly and return CLI-usage exit 2 instead of bubbling an
io::Errorthrough
main(exit 1). A second positional now reportsunexpected argument: Xinstead ofunknown option: X. Server and protocolare untouched; no docs changes needed.
Tests
boolean flags, and representative success/error cases;
cargo nextest run --lockedis green.message instead of the old
Error: Custom { ... }wrapper.the expected output/match.
Hit this running herdr across two machines with claude/codex/kimi agent
fleets, scripting output gates on
pane read/wait-output.