diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index faf81dd..e34bf99 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -382,7 +382,7 @@ fn parse_args(args: &[String]) -> Result { let mut compact = false; let mut base_commit: Option = None; let mut reasoning_effort: Option = None; - let mut rest = Vec::new(); + let mut rest: Vec = Vec::new(); let mut index = 0; while index < args.len() { @@ -391,6 +391,31 @@ fn parse_args(args: &[String]) -> Result { wants_help = true; index += 1; } + "--help" | "-h" + if !rest.is_empty() + && matches!( + rest[0].as_str(), + "prompt" + | "login" + | "logout" + | "version" + | "state" + | "init" + | "export" + | "commit" + | "pr" + | "issue" + ) => + { + // `--help` following a subcommand that would otherwise forward + // the arg to the API (e.g. `claw prompt --help`) should show + // top-level help instead. Subcommands that consume their own + // args (agents, mcp, plugins, skills) and local help-topic + // subcommands (status, sandbox, doctor) must NOT be intercepted + // here — they handle --help in their own dispatch paths. + wants_help = true; + index += 1; + } "--version" | "-V" => { wants_version = true; index += 1;