BurntSushi/ripgrep
ripgrep's extension seams are almost all static tables and traits rather than runtime plugin systems. Adding a flag means adding one unit struct implementing `Flag` and one entry in the `FLAGS` slice; everything downstream (parser trie, `-h`, `--help`, man page, four shell completions) derives from that. Adding a file type means one line in `DEFAULT_TYPES`. Adding a decompressor means one `add(glob, ARGS, &mut cmds)` line. At the library level, `Matcher` and `Sink` are the two real trait-based extension points: any regex engine implementing `grep_matcher::Matcher` can be plugged into the searcher, and any output format implementing `grep_searcher::Sink` can consume results. The `ParallelVisitorBuilder` trait in `ignore` lets external callers drive the parallel walker with their own per-thread state.
- The primary extension point is the `Flag` trait plus the `FLAGS: &[&dyn Flag]` slice; the module doc states the `defs` module "provides a single global slice of `&dyn Flag` values corresponding to all of the flags in ripgrep" used via dynamic dispatch.
- One `Flag` impl can expose four user-visible names — short, long, `name_negated()` and an arbitrary `aliases()` list — as with `-E`/`--encoding`/`--no-encoding` sharing a single implementation.
- `Category` (Input, Search, Filter, Output, OutputModes, Indexing, Logging, OtherBehaviors) is the grouping key for generated docs; `Category::as_str` returns the template variable name interpolated into help and man templates.
- `CompletionType` (Other, Filename, Executable, Filetype, Encoding) is the hook a new flag uses to tell all four shell completion generators what to complete.
- Four completion generators are registered in `flags::mod` as `generate_complete_bash/zsh/fish/powershell` and surfaced through `GenerateMode`; adding a shell means adding a module under `flags/complete/` and a `GenerateMode` variant.
- `grep_searcher::Sink` is the output extension trait — implement `matched`, `context`, `context_break`, `binary_data`, `begin`, `finish` — and the crate ships a `sinks` submodule of closure-based conveniences (e.g. `UTF8`) for quick use.
- `grep_matcher::Matcher` is the regex-engine extension trait; `grep-regex` and `grep-pcre2` are two implementations, and `PatternMatcher` in core is the enum that selects between them at runtime.
- Printers are extended by adding a `Printer<W>` enum variant plus a `printer_*` builder in `HiArgs`; each variant only needs `get_mut()` and a `sink_with_path` method for `search_path`/`search_reader` to work.
- New file types plug into `DEFAULT_TYPES`, a `&[(&[&str], &[&str])]` table of (names, globs) that the doc comment explicitly invites PRs against; users extend it per-invocation with `TypesBuilder::add`/`add_def`.
- New decompressors plug into `default_decompression_commands()` via a single `add(glob, ARGS_X, &mut cmds)` call; unavailable binaries are silently skipped after `resolve_binary` fails with a debug log.
- `ignore::ParallelVisitorBuilder` and `WalkParallel::visit` let external code supply per-thread visitors with owned state, as an alternative to the closure-based `run`.
- `WalkBuilder::filter_entry` and `add_custom_ignore_filename` are the per-caller filtering hooks; ripgrep itself uses the latter to register `.rgignore`.
- `HyperlinkFormat` implements `FromStr` with named aliases (`HyperlinkAlias`), so new editor URL schemes are added by extending the alias table rather than the printer.
- `IndexDiscovery` is configurable rather than hard-wired: `env_name()`, `dir_name()`, `cwd()` and `create()` builders let embedders relocate the index away from `RIPGREP_INDEX_PATH`/`.ripgrep`.
- The `grep` facade crate is the intended embedding point for third parties, re-exporting the whole stack under one dependency, with a worked `simplegrep` example.