pub fn gate_probe(argv: &[String]) -> Result<Gated<'static>, String>Expand description
Gate a (def-expanded) probe argv. Returns how it may run, or a refusal naming the reason. The gate is fail-closed and compiled in.
ยงExamples
use coding_tools::rules::{gate_probe, Gated};
let ok = |argv: &[&str]| gate_probe(&argv.iter().map(|s| s.to_string()).collect::<Vec<_>>());
assert!(matches!(ok(&["ct-search", "--base", "src"]), Ok(Gated::Observer)));
assert!(matches!(ok(&["cargo", "tree", "-d"]), Ok(Gated::Bridge(_))));
assert!(ok(&["ct-each", "--mutating", "--", "ct-edit"]).is_err()); // mutating never
assert!(ok(&["ct-check"]).is_err()); // no self-recursion
assert!(ok(&["cargo", "publish"]).is_err()); // unlisted prefix
assert!(ok(&["rm", "-rf", "x"]).is_err());