Files
rich-print/README.md
Yunxiao Xu 0f93d3a095
All checks were successful
CI / lint (push) Successful in -26s
CI / typecheck (push) Successful in -23s
CI / test (3.12) (push) Successful in -25s
CI / test (3.13) (push) Successful in -24s
CI / test (3.14) (push) Successful in -24s
CI / lint (pull_request) Successful in -28s
CI / test (3.14) (pull_request) Successful in -24s
CI / typecheck (pull_request) Successful in -24s
CI / test (3.12) (pull_request) Successful in -25s
CI / test (3.13) (pull_request) Successful in -24s
Add watch mode for live file monitoring
Add --watch flag that polls a file and redraws the terminal when its
content changes. Useful for monitoring log files, configuration files,
or any file that changes over time.

Features:
- Polls file every 1 second for changes
- Disables pager (pager would block the watch loop)
- File-only: rejects stdin or - input
- Error recovery: retries when file is missing or temporarily unreadable
- State comparison: only redraws when content actually changes
2026-04-04 05:23:28 -07:00

2.0 KiB

rp

Rich print files — markdown, JSON, code, and more — beautifully in your terminal.

Features

  • Syntax highlighting for 500+ languages via Pygments
  • Markdown rendering with headings, code blocks, tables, and links
  • JSON formatting with syntax highlighting
  • Pager integration with mouse scrolling support
  • Stdin support for piping content
  • Watch mode for live file redraws

Installation

Install globally with uv

uv tool install .

Run directly with uv

uv run rp <file>

Usage

Basic file input

rp README.md
rp config.json
rp script.py

Read from stdin

cat data.json | rp
echo '{"status": "ok"}' | rp
curl -s https://api.example.com | rp

Force file type

rp --type python script.txt
rp -t json data.txt

Guess from content

cat patch.txt | rp --guess-content
rp --guess-content snippet.txt

Pager control

rp --pager README.md      # Force pager
rp --no-pager file.py     # Disable pager

The pager prefers less -R --mouse for mouse scrolling when available, otherwise falls back to the system pager.

Watch a file

rp --watch README.md
rp --watch --type json data.txt

--watch is file-only. It does not support stdin or -, disables the pager, redraws the screen when the file changes, and keeps retrying if the file becomes missing or temporarily unreadable.

Show version

rp --version

Development

Setup

uv sync

Testing

uv run pytest           # Run all tests
uv run pytest -v        # Verbose output
uv run pytest tests/test_detect.py  # Single file

Linting & Type Checking

uv run ruff check src/
uv run ruff format src/
uv run mypy src/

Build

uv build

Workflow

  • main — stable release branch
  • dev — integration branch for day-to-day work
  • Short-lived branches: feature/<topic>, fix/<topic>, docs/<topic>
  • Open PRs into dev (squash merge); merge dev to main for releases

License

MIT