Skip to main content

Module filter

Module filter 

Source
Expand description

rgx filter subcommand — live/non-interactive regex filter over stdin or a file.

Re-exports§

pub use app::FilterApp;
pub use app::Outcome;

Modules§

app
TUI-mode state for rgx filter.
json_path
Minimal dotted/indexed path language for JSONL field extraction.
run
TUI event loop for rgx filter.
ui
Rendering for rgx filter TUI mode.

Structs§

FilterOptions

Constants§

EXIT_ERROR
EXIT_MATCH
Exit codes, matching grep conventions.
EXIT_NO_MATCH

Functions§

emit_count
Emit only the count of matched lines.
emit_matches
Emit matching lines to writer. If line_number is true, each line is prefixed with its 1-indexed line number and a colon.
entry
CLI entry point for rgx filter. Reads input, decides between non-interactive and TUI modes, and returns an exit code.
extract_strings
Returns per-line extracted strings. None means the line should be excluded from matching (JSON parse failure, path miss, or non-string value). The returned vector has the same length as lines, so callers can index it directly alongside the raw lines.
filter_lines
Apply the pattern to each line. Returns the 0-indexed line numbers of every line whose match status (matches vs. invert) satisfies options.invert.
filter_lines_with_extracted
Apply the pattern to the extracted string for each line. Lines whose extracted[i] is None are excluded from the match set regardless of whether the pattern is empty or invert is set — a missing/non-string field is not a “line” for matching purposes.
read_input
Read all lines from either a file path or the provided reader (typically stdin). Trailing \n/\r\n is stripped per line. A trailing empty line (from a terminating newline) is dropped.