pub fn find_split_template_token(command: &str) -> Option<String>Expand description
Scan a built command string for an unquoted Go/Handlebars-style template
token ({{ ... }}) that contains an unquoted space.
Such a token is split by the shell (and by command-stream, which mirrors
shell word-splitting) into multiple argv words, so --format {{json .X}}
reaches the child as --format, {{json, .X}} — exactly what a POSIX
shell would do, but surprising for Go templates. Returns the offending
snippet so callers can point the user at the gotcha.
§Examples
use command_stream::quote::find_split_template_token;
assert_eq!(
find_split_template_token("docker inspect --format {{json .Config.Env}}"),
Some("{{json .Config.Env}}".to_string())
);
// Space-free or quoted tokens are not flagged.
assert_eq!(find_split_template_token("docker inspect --format {{.Id}}"), None);
assert_eq!(
find_split_template_token("docker inspect --format '{{json .Config.Env}}'"),
None
);