Skip to main content

parse_grep

Function parse_grep 

Source
pub fn parse_grep(raw: &str) -> (Vec<SearchMatch>, bool)
Expand description

Parse the NUL-framed git grep -z -n output (<tree>:<path>\0<line>\0<text>\n).

ยงExamples

use solid_pod_rs_forge::search::parse_grep;

let (m, truncated) = parse_grep("main:docs/a:b.txt\u{0}3\u{0}hello\nmain:x\u{0}1\u{0}y\n");
assert_eq!(m[0].path, "docs/a:b.txt");
assert_eq!(m[0].line, 3);
assert_eq!(m[1].text, "y");
assert!(!truncated);