BurntSushi/ripgrep
ripgrep's user surface is a single command with a very large flag set: `FLAGS` in `crates/core/flags/defs.rs` is a static slice of `&dyn Flag` trait objects, each carrying short/long/negated/alias names, a documentation category, short and long (mdoc) help text, a completion type, and an `update` method that mutates `LowArgs`. Beyond plain search, the binary has distinct top-level modes — `--files`, `--type-list`, `--generate`, `-h/--help`/`-V/--version` special modes, and the experimental index modes. Output modes (`--count`, `--count-matches`, `-l/--files-with-matches`, `--files-without-match`, `--json`) select among three printers. Filtering features include gitignore semantics, `-t/--type` file types, `-g/--glob` overrides, hidden-file handling and `--max-filesize`. Provider-style integrations are the pluggable regex engine (`--engine auto|default|pcre2`), decompression (`-z`), arbitrary preprocessors (`--pre`), and terminal hyperlinks.
- `Mode` enumerates the five top-level behaviors — `Search(SearchMode)`, `Index(IndexMode)`, `Files`, `Types`, `Generate(GenerateMode)` — with `Mode::Search(SearchMode::Standard)` as the default.
- `SearchMode` has six variants (`Standard`, `FilesWithMatches`, `FilesWithoutMatch`, `Count`, `CountMatches`, `JSON`) and `HiArgs::printer` maps them onto `Printer::Standard`, `Printer::JSON` or `Printer::Summary` with a `SummaryKind`.
- `--generate` emits ancillary artifacts: `GenerateMode::Man` produces roff, and `CompleteBash`/`CompleteZsh`/`CompleteFish`/`CompletePowerShell` produce shell completions, all rendered from the same `FLAGS` table.
- `-h` and `--help` render different documents (`generate_short` vs `generate_long`) from `template.short.help` / `template.long.help`, interpolating per-category placeholders like `!!filter!!` and `!!output-modes!!`.
- `--type-list` is implemented by `types()` in main, which iterates `args.types().definitions()` and prints `name: glob, glob` lines, exiting 1 if there are no definitions.
- ripgrep ships a large built-in file-type table, `DEFAULT_TYPES`, mapping type names to glob lists (e.g. `ada` → `*.adb`,`*.ads`), extensible per-invocation via `--type-add`.
- Three regex engine choices are supported: `EngineChoice::Default` (Rust regex), `PCRE2`, and `Auto`, where `Auto` tries Rust first and falls back to PCRE2, reporting both errors side by side if both fail.
- `-z/--search-zip` transparently decompresses by file extension using external binaries: gzip, bzip2, xz (also for `.lzma`), lz4, brotli, zstd and `uncompress`, keyed by globs like `*.gz`, `*.tgz`, `*.zst`, `*.Z`.
- `--pre` runs an arbitrary user program per file with the path as argv[1] and the file on stdin, optionally restricted by `--pre-glob` via `preprocessor_globs`.
- Hyperlink support is a first-class feature with named aliases (e.g. `"vscode".parse::<HyperlinkFormat>()`) and interpolation variables including `{host}` and a `{wslprefix}` derived from `WSL_DISTRO_NAME`.
- Sorting is user-selectable across four criteria — `path`, `modified`, `accessed`, `created` — with reverse variants; `HiArgs::sort` special-cases ascending path sort to be done during traversal instead of by buffering.
- The experimental indexing surface consists of `--x-crud` (create/update/remove index entries), `--x-index-force` and `--x-index-path`, all in the `Category::Indexing` group, which renders as "Indexing is not supported in this build of ripgrep." when the feature is off.
- `--stats` produces either a human block (matches / matched lines / files searched / bytes printed / seconds) or, in JSON mode, an extra `{"type":"summary"}` record with `elapsed_total`.
- `ignore` exposes a second public feature beyond traversal: `IncrementalIgnore`, built via `WalkBuilder::build_matchers()`, which checks individual paths against hierarchical ignore files without re-walking the tree.