utils/ripgrep/ripgrep_utils
library
Functions
-
countFilesRoundedRg(String dirPath, {List<String> ignorePatterns = const [], Duration? timeout})
→ Future<int?>
-
Count files in a directory recursively using ripgrep and round to the
nearest power of 10 for privacy.
-
getRipgrepConfig({bool? useSystemRipgrep, bool? isBundledMode, String? vendorRoot})
→ RipgrepConfig
-
Get the ripgrep configuration. Determines whether to use system, builtin,
or embedded ripgrep. Memoized after first call.
-
getRipgrepStatus()
→ ({RipgrepMode mode, String path, bool? working})
-
Get ripgrep status and configuration info.
Returns current configuration immediately, with working status if available.
-
resetFileCountCache()
→ void
-
Reset the file count cache (useful for testing).
-
resetRipgrepConfig()
→ void
-
Reset the cached config (useful for testing).
-
ripGrep(List<String> args, String target, {Duration? timeout})
→ Future<List<String>>
-
Execute ripgrep with the given arguments and target directory/file.
Returns a list of matching lines.
-
ripgrepCommand()
→ ({String? argv0, List<String> rgArgs, String rgPath})
-
Public accessor for ripgrep command components.
-
ripGrepFileCount(List<String> args, String target, {Duration? timeout})
→ Future<int>
-
Stream-count lines from
rg --files without buffering stdout.
-
ripGrepStream(List<String> args, String target, {required void onLines(List<String> lines)})
→ Future<void>
-
Stream lines from ripgrep as they arrive, calling
onLines per stdout
chunk.
Exceptions / Errors
-
RipgrepTimeoutError
-
Custom error class for ripgrep timeouts. Allows callers to distinguish
between "no matches" and "timed out".