Expand description
Core library: config loading, colorization, and regex engine selection.
Re-exports§
pub use style::Style;
Modules§
- args
- CLI argument parsing.
- buffer
- Line-buffered writer: flushes after each newline for real-time output.
- colorizer
- Apply regex-based color rules to input text line by line.
- enhanced_
regex - Lightweight lookahead/lookbehind support on top of
regex_lite. - grc
- Parse grc.conf (command to config mapping) and grcat config files
(regex + style rules). Uses a hybrid regex engine: standard
regex_litefor simple patterns, fancy-regex or EnhancedRegex for lookarounds. - style
- Zero-dependency ANSI styling: 8 colors, bright variants, text attributes.
- utils
- utils.rs - Utility functions for rgrc
Enums§
- Color
Mode - On = always color, Off = never, Auto = only when stdout is a TTY.
Constants§
- EMBEDDED_
CONFIGS - Embedded configuration files compiled into the binary when the
embed-configsfeature is enabled. Each entry is a tuple of(filename, contents)corresponding to files undershare/conf.*. This file is generated by build.rs; do not edit. - EMBEDDED_
CONFIG_ NAMES - Names of the embedded config files (sorted)
- EMBEDDED_
GRC_ CONF
Functions§
- load_
config - Load rules for
pseudo_commandby matching it against the patterns in the mapper file atpath, then reading the referenced conf file from the first matching resource path. Embedded configs are the last resort so that user files on disk always win. Returns empty vec on any failure. - load_
grcat_ config - Load and parse a grcat conf file. Returns empty vec on any error
(file not found, parse failure). Falls back to embedded cache when
the
embed-configsfeature is enabled. - load_
rules_ for_ command - Load colorization rules for a given pseudo-command by searching all
configuration paths. The search stops at the first mapper file that yields
rules. Priority: user mapper (
$XDG_CONFIG_HOME/rgrc/rgrc.conf), then the remaining mapper paths ending with legacy grc locations; the embedded mapper is the last resort. - load_
rules_ for_ config - Rules for an explicitly requested config (
-c NAME): NAME is first tried as a pseudo-command against the mappers, then directly as a conf file name (“df” resolves to conf.df; “conf.df” and paths are used as-is). - resource_
paths - Search paths for conf files, user config first, system/legacy last.
Honors the XDG base directory environment variables; grc paths are kept
for compatibility. The development
share/dir requires RGRC_DEV_SHARE.