CLI: clap-based parser and parse_cli_args() helper #15

Closed
opened 2026-04-11 10:55:40 +00:00 by charles · 0 comments
Owner

User story

As a test-binary author, I want a one-liner that wires CLI flags into RunConfig (and optionally overrides harness config), so that I don't write argument parsing boilerplate in every test binary.

Acceptance criteria

  • Cli struct with clap derive supporting all options listed in spec §7:
    • --binary <PATH>
    • --host <HOST> (default 127.0.0.1)
    • --port <PORT> (default 9820)
    • --health-url <URL>
    • --ws-url <URL>
    • --token <TOKEN>
    • --filter <PATTERN>
    • --tag <TAG>
    • --fail-fast
    • --timeout <SECS> (default 60)
    • --format <FORMAT> — one of console, json, junit (case-insensitive); default console
    • --no-color
    • --startup-timeout <SECS> (default 15)
    • -v / --verbose
    • --parallel
  • runner.parse_cli_args() parses std::env::args(), applies the result to its internal RunConfig, and overrides harness fields (command from --binary, health_url, ws_url, etc.) when present.
  • --filter and --tag populate RunConfig.filter / tag.
  • Invalid --format value produces a clean clap error message, not a panic.
  • --help text is descriptive; each flag has a help line.
  • clap is gated behind a cli feature, on by default, so consumers who provide their own arg parser can disable it.
  • Unit test ensures parsing the spec's example invocation produces the expected RunConfig and harness overrides.

Resolves

Spec review §9 (clap unlisted in dependencies — will be added via this story).

References

  • Spec §7
## User story As a **test-binary author**, I want a one-liner that wires CLI flags into `RunConfig` (and optionally overrides harness config), so that I don't write argument parsing boilerplate in every test binary. ## Acceptance criteria - [ ] `Cli` struct with `clap` derive supporting all options listed in spec §7: - `--binary <PATH>` - `--host <HOST>` (default `127.0.0.1`) - `--port <PORT>` (default `9820`) - `--health-url <URL>` - `--ws-url <URL>` - `--token <TOKEN>` - `--filter <PATTERN>` - `--tag <TAG>` - `--fail-fast` - `--timeout <SECS>` (default 60) - `--format <FORMAT>` — one of `console`, `json`, `junit` (case-insensitive); default `console` - `--no-color` - `--startup-timeout <SECS>` (default 15) - `-v / --verbose` - `--parallel` - [ ] `runner.parse_cli_args()` parses `std::env::args()`, applies the result to its internal `RunConfig`, and overrides harness fields (`command` from `--binary`, `health_url`, `ws_url`, etc.) when present. - [ ] `--filter` and `--tag` populate `RunConfig.filter` / `tag`. - [ ] Invalid `--format` value produces a clean clap error message, not a panic. - [ ] `--help` text is descriptive; each flag has a help line. - [ ] `clap` is gated behind a `cli` feature, **on by default**, so consumers who provide their own arg parser can disable it. - [ ] Unit test ensures parsing the spec's example invocation produces the expected `RunConfig` and harness overrides. ## Resolves Spec review §9 (clap unlisted in dependencies — will be added via this story). ## References - Spec §7
charles added this to the v0.1.0 milestone 2026-04-11 10:55:40 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/ws-rpc-test#15
No description provided.