rgrc

Development Guide

Add new commands

  1. Create a new config file in share/ (e.g., conf.mycommand)
  2. Add rules in the format:
    regexp=REGEX
    colours=COLOR1,COLOR2,...
    
  3. Test with:
    echo "ERROR: Something went wrong" | cargo run --  -c conf.mycommand
    
  4. Enable command in src/rgrc.conf to load the new config file. after that, the command will be available as rgrc mycommand (or via alias if configured).

Testing

# Run tests
make test
# Run tests with coverage
make cov

Code Formatting and Linting

make check

Local Installation

make install

# Uninstall
make uninstall

Advanced Features

Count/Replace

# Match only once per line
regexp=^\s*#
colours=cyan
count=once

# Replace matched text (with backreferences)
regexp=(ERROR|WARN|INFO)
colours=red,yellow,green
replace=[\1]

# Stop processing after match
regexp=^FATAL
colours=red,bold
count=stop

Count options: once, more (default), stop Replace: Supports \1, \2, etc.