Skip to main content

parse_slash_line

Function parse_slash_line 

Source
pub fn parse_slash_line(s: &str) -> Option<(&str, &str)>
Expand description

Parse "/cmd args..." into (cmd, args) when the leading / is a command invocation. Returns None when the / is actually part of a filesystem path, URL, or any other text the user wants sent to the agent verbatim.

A valid command name is ASCII alphanumeric + _/-, followed by whitespace or end-of-input. /Users/me, /tmp, /https://..., /path/with/mixed/字符 all fail the shape test and fall through to agent dispatch.