Skip to content

Instantly share code, notes, and snippets.

@up1
Last active September 7, 2026 15:25
Show Gist options
  • Select an option

  • Save up1/4c78045df410c064f2b7bf41fbff73fa to your computer and use it in GitHub Desktop.

Select an option

Save up1/4c78045df410c064f2b7bf41fbff73fa to your computer and use it in GitHub Desktop.
Hello tgrep
$tgrep
Usage: tgrep <pattern> [PATH ...]
tgrep index [path]
tgrep serve [path]
tgrep status [path]
Search defaults to the current directory when no path is provided.
Run `tgrep --help` for full usage.
// Indexing
$tgrep index
Walking ...
Found 2565 text files (429 binary skipped, 0 too large, 0 errors)
Extracting trigrams...
Skipped 4 additional binary files (detected by content)
Writing index (276057 trigrams, 2561 files, 0 spill segment(s))...
Index built successfully at ~/demo-code/.tgrep
Indexed in 0.2s using external strategy (peak memory 102.9 MiB)
// ผลการทำ indexing
$tree .tgrep
.tgrep
├── files-extra.bin
├── files.bin
├── filestamps.json
├── index.bin
├── lookup.bin
└── meta.json
1 directory, 6 files
$tgrep serve
[trace] opened index: 2561 files, 276057 trigrams in 1.9ms
[trace] serve ready in 5.0ms. TCP on port 54960. Cache: max 50000 entries / 1024 MiB (entries over 64 MiB not cached). Memory cap: 16384 MB. Index threads: 6. Watcher queue cap: 16384.
[trace] stale check: comparing index against filesystem...
[trace] watcher subscriptions deferred until the ignore matcher is ready
[trace] file watcher started
[trace] gitignore matcher built from stale walk in 1.4ms (24 .gitignore + 0 .ignore files)
[trace] stale check: index is up-to-date (2565 files checked in 14ms)
$tgrep --index-path <path of indexed> "your search"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment