@@ -1175,6 +1175,8 @@ fn parse_args(args: &[String]) -> Result<CliAction, String> {
11751175 model: model.clone(),
11761176 model_flag_raw: model_flag_raw.clone(),
11771177 permission_mode: get_permission_mode(),
1178+ output_format,
1179+ allowed_tools: allowed_tools.clone(),
11781180 })
11791181 }
11801182 "sandbox" => {
@@ -1571,53 +1573,26 @@ fn parse_single_word_command_alias(
15711573 }
15721574 return Some(Err(msg));
15731575 }
1574- None
1575- }
1576-
1577- // #720: `claw help <topic>` — when `help` is the verb and a topic follows,
1578- // try to route to the topic's help handler instead of erroring.
1579- if rest.len() == 2 && rest[0] == "help" {
1580- let topic_name = rest[1].as_str();
1581- let topic = match topic_name {
1582- "status" => Some(LocalHelpTopic::Status),
1583- "sandbox" => Some(LocalHelpTopic::Sandbox),
1584- "doctor" => Some(LocalHelpTopic::Doctor),
1585- "acp" => Some(LocalHelpTopic::Acp),
1586- "init" => Some(LocalHelpTopic::Init),
1587- "state" => Some(LocalHelpTopic::State),
1588- "export" => Some(LocalHelpTopic::Export),
1589- "version" => Some(LocalHelpTopic::Version),
1590- "system-prompt" => Some(LocalHelpTopic::SystemPrompt),
1591- "dump-manifests" => Some(LocalHelpTopic::DumpManifests),
1592- "bootstrap-plan" => Some(LocalHelpTopic::BootstrapPlan),
1593- "agents" | "agent" => Some(LocalHelpTopic::Agents),
1594- "skills" | "skill" => Some(LocalHelpTopic::Skills),
1595- "plugins" | "plugin" | "marketplace" => Some(LocalHelpTopic::Plugins),
1596- "mcp" => Some(LocalHelpTopic::Mcp),
1597- "config" => Some(LocalHelpTopic::Config),
1598- "diff" => Some(LocalHelpTopic::Diff),
1599- _ => None,
1600- };
1601- if let Some(t) = topic {
1602- return Some(Ok(CliAction::HelpTopic {
1603- topic: t,
1604- output_format,
1605- }));
1606- }
1607- // Unknown topic falls through to the generic help action.
1608- return Some(Ok(CliAction::Help { output_format }));
1609- }
16101576
16111577 if rest.len() != 1 {
16121578 return None;
16131579 }
1614- if tail.len() > max_args {
1615- return Some(Err(format!(
1616- "unexpected extra arguments after `claw {command}`: {}",
1617- tail[max_args..].join(" ")
1618- )));
1580+
1581+ match verb.as_str() {
1582+ "status" => Some(Ok(CliAction::Status {
1583+ model: model.to_string(),
1584+ model_flag_raw: model_flag_raw.map(|s| s.to_string()),
1585+ permission_mode: permission_mode_override.unwrap_or_else(default_permission_mode),
1586+ output_format,
1587+ allowed_tools,
1588+ })),
1589+ "sandbox" => Some(Ok(CliAction::Sandbox { output_format })),
1590+ "doctor" => Some(Ok(CliAction::Doctor { output_format })),
1591+ "state" => Some(Ok(CliAction::State { output_format })),
1592+ "help" => Some(Ok(CliAction::Help { output_format })),
1593+ "version" => Some(Ok(CliAction::Version { output_format })),
1594+ _ => None,
16191595 }
1620- None
16211596}
16221597
16231598fn is_help_only(tail: &[String]) -> bool {
0 commit comments