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.
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.
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.
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.