Files
ottyl/tickets/096-clap-short-flags.md
T
2026-09-07 12:16:36 +01:00

1.3 KiB

096 — Add single-character short flags to clap CLI args

Summary

None of the CLI's clap-defined flags have a short form — every option is long-only, including ones that are typed often (--file, --metrics-url).

Where

  • src/cli/mod.rs:20-39 — top-level Args struct, all fields #[arg(long, ...)] with no short:
    • port: u16 — :25-26, default_value_t = 0
    • settings_path: Option<PathBuf> — :28-29
    • file: Option<PathBuf> — :31-32
    • metrics_url: Option<String> — :34-35
    • name: Option<String> — :37-38
  • src/cli/mod.rs:41-50 — Command::Mcp subcommand, also long-only:
    • session: Option<String> — :44-45
    • port: Option<u16> — :46-47

Scope

  • Add short to each flag where the initial letter is unambiguous within its own Args/subcommand struct: -p (port), -f (file), -m (metrics-url), -n (name), -s (settings-path or session, whichever reads more naturally per subcommand — they're in separate structs so both can use -s without conflict).
  • Mcp's port can reuse -p since it's a distinct struct from the top-level Args.
  • Verify with cargo run -- --help (and the mcp subcommand's --help) that clap doesn't reject any of these for collision, and update README.md's CLI usage section if it documents flags explicitly.