Skip to content

smelt.grep

Tier: Host — Available in every runtime, including headless mode.

Ripgrep wrapper for searching files. Exit code 1 (no match) is not an error.

smelt.grep.run

fun(pattern: string, path: string, opts: table?): table?, string?

Run ripgrep with pattern over path. opts accepts mode (content/files_with_matches/count), case_insensitive, multiline, line_numbers, before_context/after_context/context, glob, type, timeout_secs. Returns (result_table, nil) on success or (nil, error_string) on spawn failure. Exit code 1 (no match) is not an error — inspect exit_code on the result.