Skip to content

Instantly share code, notes, and snippets.

@standarddeviant
Created March 23, 2024 12:16
Show Gist options
  • Save standarddeviant/4c96bfc757f2d7034f3c9ce14092056e to your computer and use it in GitHub Desktop.
Save standarddeviant/4c96bfc757f2d7034f3c9ce14092056e to your computer and use it in GitHub Desktop.
# search for 'pub fn' and capture paths, and lines
# NOTE: could get line number
let tmp = rg --json 'pub fn' | rg '"type":"match"' | from json -o
echo ($tmp | each {|m| $m.data}) # debug
let df = $tmp | each {
|m| {
path: $m.data.path.text,
line: ($m.data.lines.text | str trim)
}
}
echo $df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment