pub fn parse(content: &str) -> Vec<HookCommand>Expand description
Parse the text content of a .githooks/<hook>.hooks file.
Blank lines and comment lines (starting with #) are skipped.
Each remaining line is parsed into a HookCommand with its
prefix, command text, and optional trailing glob pattern.
ยงExample
use standard_githooks::{parse, Prefix};
let input = "# Formatting\ndprint check\n!cargo clippy --workspace -- -D warnings *.rs\n? detekt --input modules/ *.kt\n";
let commands = parse(input);
assert_eq!(commands.len(), 3);
assert_eq!(commands[0].prefix, Prefix::Default);
assert_eq!(commands[0].command, "dprint check");
assert_eq!(commands[0].glob, None);
assert_eq!(commands[1].prefix, Prefix::FailFast);
assert_eq!(commands[1].command, "cargo clippy --workspace -- -D warnings");
assert_eq!(commands[1].glob, Some("*.rs".to_string()));
assert_eq!(commands[2].prefix, Prefix::Advisory);
assert_eq!(commands[2].command, "detekt --input modules/");
assert_eq!(commands[2].glob, Some("*.kt".to_string()));