Grox is a command-line tool that searches a file tree for regex matches.
# Usage
For example,
```text
$ grox the
(1) ./lib.rs:19: ... / * `file` - Path to the file.
(2) ./lib.rs:20: ... e number (1-up) of the match.
(3) ./lib.rs:50: ... rror message if either `max_depth` was ...
(4) ./lib.rs:51: ... n't have access to the starting direct ...
(5) ./lib.rs:151: .and_then(|name| name.to ...
(6) ./lib.rs:152: .and_then(|name| name.ch ...
(7) ./lib.rs:314: ... oing to fold my clothes"
(8) ./main.rs:18: ... tory. Defaults to the current working ...
(9) ./main.rs:28: ... hort, help = "Open the file for the spec ...
```
By default the search starts with the current working directory. You can change this by `-d DIRECTORY`.
You can limit the directory search depth by `-p DEPTH`. A depth of 1 searches only the starting directory.
If you only want to get the names of the matching files, add `-n`:
```text
$ grox the -n
(1) ./lib:rs
(2) ./main.rs
```
If you only want to search files whose names match a certain pattern, you can use `-f`:
```text
$ grox the -f '\.rs$'
```
## Opening files
You can open the n-th match in an editor with the `-l` option. For example, say you found these matches:
```text
$ grox some_pattern
(1) file1.txt:55: ...
(2) file2:txt:2: ...
```
If you wanted to open up file1.txt, you could run the search again with `-l`:
```text
$ grox some_pattern -l 1
```
If the `EDITOR` environment variable is set, then Grox will use the specified executable. Otherwise, it will try to use vim followed by vi. You can manually specify the editor by
```text
$ grox some_pattern -l 1 -e less
```
If the chosen editor is either vim or vi, then Grox will open up the file to the line containing the match.