Skip to main content

command_matches

Function command_matches 

Source
pub fn command_matches(rule: &[String], argv: &[String]) -> bool
Expand description

Whether a policy command rule, such as ["git", "push", "--force"], matches one program invocation.

The program is compared by name. Options between the program and the rule’s first word are skipped, with the value of an option known to take one (git -C <dir>), so git -C . push --force matches. The rule’s first word after the program must be the first argument left; its later words must follow in order, anywhere after it, so git push origin --force matches too. A rule word that is a cluster of short options, such as -rf, matches when each letter is set by a short option cluster after it (-r -f, -fr).