#tree-sitter #query #language #command-line

app tsfind

Extract code using tree-sitter queries

5 releases

new 0.2.9 Sep 14, 2024
0.2.8 Sep 13, 2024

#633 in Filesystem

Download history 431/week @ 2024-09-10

431 downloads per month

MIT license

15KB
304 lines

tsfind

Demo

Extract code using tree-sitter queries.

Inspired by helixbass/tree-sitter-grep which reports entire lines instead of just the captures.

Quite WIP, command line interface should be considered unstable - use at your own risk.

Usage

Extract code using tree-sitter queries

Usage: tsfind [OPTIONS] <LANGUAGE> [PATHS]...

Arguments:
  <LANGUAGE>  [possible values: rust, go, js, ts, tsx, php, php-only]
  [PATHS]...  

Options:
  -q, --query <QUERY>            The query to find matches for
  -Q, --query-file <QUERY_FILE>  The file containing the query to find matches for
  -H, --hidden                   Recurse into hidden files and directories
  -C, --hidden-captures          Show captures starting with '_'
  -t, --only-text                Only report captured text
  -l, --list                     Only report files with matches
  -s, --separator <SEPARATOR>    Separator for matches. Only useful with --only-text/-t or --list/-l [default: "\n"]
  -h, --help                     Print help
  -V, --version                  Print version

Dependencies

~9–29MB
~566K SLoC