pub fn extract_command_texts(command: &str) -> Result<Vec<String>>Expand description
Collect the full text of every command node in the script.
Descends through pipelines, lists, subshells, command/process substitution,
loops and conditionals, so an allowlist can be enforced against EVERY command
a line would run — not just command_line.split_whitespace().next(), which
ls && curl|sh, ls $(rm -rf x) and a; rm -rf / trivially bypass.
Returns Err when the command can’t be parsed cleanly; restricted-mode
callers treat that as “not allowed” (fail closed). Code hidden inside a
quoted string (e.g. bash -c '...') is opaque to the parser, so an allowlist
that permits bash/sh/eval stays effectively unrestricted by design.