pub fn parse_command(body: &str) -> Option<Command>Expand description
Parse a comment body into a Command, or None if it isn’t one.
The command must be the first token of the comment. /ask takes the rest of
the comment (which may span multiple lines) as its question; an empty question
yields None. Surrounding whitespace is ignored.
§Examples
assert_eq!(parse_command("/review"), Some(Command::Review));
assert_eq!(parse_command(" /describe \n"), Some(Command::Describe));
assert_eq!(parse_command("/ask why is this safe?"), Some(Command::Ask("why is this safe?".into())));
assert_eq!(parse_command("/ask"), None); // no question
assert_eq!(parse_command("please /review"), None); // not the first token
assert_eq!(parse_command("/reviews"), None); // no fuzzy match