bat-extras: batwatch

March 21, 2023 ยท View on GitHub

Watch for changes in files or command output, and print them with bat.

Usage

batwatch [OPTIONS] FILE...

batwatch [OPTIONS] --command COMMAND [ARG...]

Options

ShortLongDescription
--command|-xExecute a command on an interval.
--file|-fWatch a file for changes.
--watcher=[watcher]Use a specific program to watch for file changes. See below for more details.
--interval=[seconds]The interval for executing commands.
--clearClear the screen before printing the files.
This is enabled by default.
--no-clearDo not clear the screen before printing the files.
--colorForce color output.
--no-colorForce disable color output.

All remaining options are passed through to bat.

Watchers

Batwatch uses external programs to watch for file changes. Currently, the following programs are supported:

There is also a fallback poll watcher available.

Installation

This script is a part of the bat-extras suite of scripts. You can find install instructions here.

Issues?

If you find an issue or have a feature suggestion, make a pull request or issue through GitHub! Contributions are always welcome.