#tree #tree-search #regex #grep #search-pattern #search

app treegrep

一个模式匹配前端或后端,以树形结构显示结果

5 个版本

0.1.4 2024年6月3日
0.1.3 2024年1月22日
0.1.2 2024年1月11日
0.1.1 2024年1月4日
0.1.0 2024年1月2日

#227文本处理

CC-BY-4.0

125KB
2.5K SLoC

treegrep

treegrep 是现有模式匹配器的前端或独立的模式匹配器,以树形格式呈现结果

tests release

https://github.com/4imothy/treegrep/assets/40186632/9c85c309-df78-4996-8127-ee5ad9f91ec3

当前支持的后端

crates.io | GitHub | AUR | NetBSD

安装

Cargo

cargo install treegrep

NetBSD

pkgin install treegrep

版本

版本 下载

手册

git clone https://github.com/4imothy/treegrep
cd treegrep
cargo build --release

--help 输出

treegrep 0.1.4
by Timothy Cronin

A pattern matcher frontend or backend which displays results in a tree

tgrep [OPTIONS] [positional regexp] [positional target]

Arguments:
  [positional regexp]  specify the regex expression
  [positional target]  specify the search target. If none provided, search the current directory.

Options:
  -e, --regexp <>      specify the regex expression
  -t, --target <>      specify the search target. If none provided, search the current directory.
  -c, --count          display number of files matched in directory and number of lines matched in a file if present
  -., --hidden         search hidden files
  -n, --line-number    show line number of match if present
  -m, --menu           open results in a menu to be edited with $EDITOR
                       navigate through the menu using the following commands:
                        - move up/down: k/j, p/n, up arrow/down arrow
                        - move up/down with a bigger jump: K/J, P/N
                        - move up/down paths: {/}, [/]
                        - move to the start/end: g/G, </>, home/end
                        - move up/down a page: b/f, pageup/pagedown
                        - quit: q, ctrl + c
  -f, --files          show the paths that have matches
      --links          show linked paths for symbolic links
      --trim           trim whitespace at the beginning of lines
      --pcre2          enable PCRE2 if the searcher supports it
      --no-ignore      don't use ignore files
      --no-color       don't use colors if present
      --max-depth <>   the max depth to search
      --threads <>     set the appropriate number of threads to use
      --max-length <>  set the max length for a matched line
  -s, --searcher <>    executable to do the searching [possible values: rg, tgrep]
  -l, --tree           display the files that would be search in tree format
      --glob <>        rules match .gitignore globs, but ! has inverted meaning, overrides other ignore logic
  -h, --help           Print help
  -V, --version        Print version

Any of the above can be set using the TREEGREP_DEFAULT_OPTS environment variable

依赖

~6–15MB
~176K SLoC