pub fn prefix_allow_matches(pattern: &str, command: &str) -> boolExpand description
Return true when an allow-rule pattern (a command-prefix string such
as "git status") matches the concrete command string using the
arity-aware prefix classification from classify_command.
This is the canonical entry point for config allow / auto_allow rule
evaluation. It correctly handles:
"git status"→ matchesgit status -s,git status --porcelain; does not matchgit push origin main."npm run dev"→ matches onlynpm run dev, notnpm run build."cargo check"→ matchescargo check --workspace."make"→ matchesmake all,make clean(arity 1).
For allow rules that contain wildcards (*) or regex metacharacters, the
caller should additionally invoke the pattern-matching path from
crate::execpolicy::matcher::pattern_matches.
§Examples
assert!( prefix_allow_matches("git status", "git status --porcelain"));
assert!(!prefix_allow_matches("git status", "git push origin main"));
assert!( prefix_allow_matches("cargo check", "cargo check --workspace"));
assert!( prefix_allow_matches("npm run dev", "npm run dev"));
assert!(!prefix_allow_matches("npm run dev", "npm run build"));