Terminal UI for running and watching command output

Readme

watchr

watchr is a terminal UI for running commands and interactively browsing their output. It provides vim-style navigation, filtering, and a preview pane—all without leaving your terminal.

Release Downloads License


🚀 Features

  • Interactive output viewer: Browse command output with vim-style keybindings
  • Live filtering: Press / to filter output lines in real-time
  • Preview pane: Toggle a preview panel (bottom, top, left, or right)
  • Auto-refresh: Optionally re-run commands at specified intervals
  • Line numbers: Optional line numbering with configurable width
  • Config files: YAML, TOML, or JSON config files for persistent settings
  • Full-screen TUI: Clean, distraction-free interface using your entire terminal

🎯 Installation

Download Precompiled Binaries

Grab the latest release for Linux, macOS, or Windows:

Homebrew (macOS/Linux)

Install directly from the tap:

brew install chenasraf/tap/watchr

Or tap and then install the package:

brew tap chenasraf/tap
brew install watchr

From Source

git clone https://github.com/chenasraf/watchr
cd watchr
make build
make install  # installs to ~/.local/bin

✨ Getting Started

Basic Usage

# View output of any command
watchr ls -la

# View logs
watchr "tail -100 /var/log/system.log"

# Monitor processes
watchr "ps aux"

Auto-Refresh

# Refresh every 2 seconds
watchr -r 2 "docker ps"

# Refresh every 500 milliseconds
watchr -r 500ms "date"

# Refresh every 1.5 seconds
watchr -r 1.5s "kubectl get pods"

# Refresh every 5 minutes
watchr -r 5m "df -h"

# Refresh every hour
watchr -r 1h "curl -s https://api.example.com/status"

# Watch file changes
watchr -r 5 "find . -name '*.go' -mmin -1"

Options

Usage: watchr [options] <command to run>

Options:
  -h, --help                       Show help
  -v, --version                    Show version
  -c, --config string              Load config from specified path
  -C, --show-config                Show loaded configuration and exit
  -r, --refresh string             Auto-refresh interval (e.g., 1, 1.5, 500ms, 2s, 5m, 1h; default unit: seconds, 0 = disabled)
  -p, --prompt string              Prompt string (default "watchr> ")
  -s, --shell string               Shell to use for executing commands (default "sh")
  -n, --no-line-numbers            Disable line numbers
  -w, --line-width int             Line number width (default 6)
  -P, --preview-size string        Preview size: number for lines/cols, or number% for percentage (default "40%")
  -o, --preview-position string    Preview position: bottom, top, left, right (default "bottom")
  -i, --interactive                Run shell in interactive mode (sources ~/.bashrc, ~/.zshrc, etc.)

📁 Configuration File

watchr supports configuration files in YAML, TOML, or JSON format. Settings in config files serve as defaults that can be overridden by command-line flags.

Config File Locations

Config files are searched in the following order (later files override earlier ones):

  1. XDG config directory (Linux/macOS): ~/.config/watchr/watchr.{yaml,toml,json}
  2. Windows: %APPDATA%\watchr\watchr.{yaml,toml,json}
  3. Current directory (project-local): ./watchr.{yaml,toml,json}

Example Configurations

YAML (watchr.yaml):

shell: bash
preview-size: "50%"
preview-position: right
line-numbers: true
line-width: 4
prompt: "> "
refresh: 0           # disabled; or use: 2, 1.5, "500ms", "2s", "5m", "1h"
interactive: false

TOML (watchr.toml):

shell = "bash"
preview-size = "50%"
preview-position = "right"
line-numbers = true
line-width = 4
prompt = "> "
refresh = 0          # disabled; or use: 2, 1.5, "500ms", "2s", "5m", "1h"
interactive = false

JSON (watchr.json):

{
  "shell": "bash",
  "preview-size": "50%",
  "preview-position": "right",
  "line-numbers": true,
  "line-width": 4,
  "prompt": "> ",
  "refresh": 0,
  "interactive": false
}

The refresh option accepts:

  • Numbers: 2 or 1.5 (interpreted as seconds)
  • Explicit units: "500ms", "2s", "5m", "1h"

Priority Order

Configuration values are applied in this order (later sources override earlier ones):

  1. Built-in defaults
  2. XDG/system config file
  3. Project-local config file (current directory)
  4. Command-line flags

⌨️ Keybindings

KeyAction
r, Ctrl-rReload (re-run command)
q, EscQuit
j, kMove down/up
gGo to first line
GGo to last line
Ctrl-d, Ctrl-uHalf page down/up
PgDn, Ctrl-fFull page down
PgUp, Ctrl-bFull page up
pToggle preview pane
/Enter filter mode
EscExit filter mode / clear filter
yYank (copy) selected line
?Show help overlay

🛠️ Contributing

I am developing this package on my free time, so any support, whether code, issues, or just stars is very helpful to sustaining its life. If you are feeling incredibly generous and would like to donate just a small amount to help sustain this project, I would be very very thankful!

Buy Me a Coffee at ko-fi.com

I welcome any issues or pull requests on GitHub. If you find a bug, or would like a new feature, don’t hesitate to open an appropriate issue and I will do my best to reply promptly.


📜 License

watchr is licensed under the MIT License.