Add watch mode for live file monitoring
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
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 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
This commit is contained in:
10
README.md
10
README.md
@@ -9,6 +9,7 @@ Rich print files — markdown, JSON, code, and more — beautifully in your term
|
||||
- **JSON formatting** with syntax highlighting
|
||||
- **Pager integration** with mouse scrolling support
|
||||
- **Stdin support** for piping content
|
||||
- **Watch mode** for live file redraws
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -65,6 +66,15 @@ 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
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user