hwatch - alternative watch command.
hwatch
is a alternative watch command.
That records the result of command execution and can display it history and diffs.
brew install hwatch
sudo port install hwatch
cargo install hwatch
hwatch 0.3.7
blacknon <blacknon@orebibou.com>
A modern alternative to the watch command, records the differences in execution results and can
check this differences at after.
USAGE:
hwatch [OPTIONS] <command>...
ARGS:
<command>...
OPTIONS:
-c, --color interpret ANSI color and style sequences
-d, --differences highlight changes between updates
-N, --line-number show line number
-x, --exec Run the command directly, not through the shell. Much like the
`-x` option of the watch command.
-l, --logfile <logfile> logging file
-s, --shell <shell_command> shell to use at runtime. can also insert the command to the
location specified by {COMMAND}. [default: "sh -c"]
-n, --interval <interval> seconds to wait between updates [default: 2]
-h, --help Print help information
-V, --version Print version information
watch window keybind
Use the -n option to specify the command execution interval.
bash
hwatch -n 3 command...
The command execution result can be output as a log in json format.
bash
hwatch -n 3 -l hwatch_log.json command...
When you check the json log, you can easily check it by using this script.
If you want the shell function to be executed periodically, you can specify the shell command to be executed with -s as follows.
```bash
hwatch -n 3 -s 'bash -c "source ~/.bashrc"; {COMMAND}' command...
hwatch -n 3 -s 'zsh -c "source ~/.zshrc"; {COMMAND}' command... ```
If you want to see output colored with ANSI color code, enable color mode.
To enable color mode, run hwatch with the -c
option.
Alternatively, you can enable / disable the color mode with the C key during execution.
bash
hwatch -n 3 -c command...
To enable color mode, run hwatch with the -d
option.
There are several "diff modes" available. Switching can be done with the D key.
bash
hwatch -n 3 -d command...
You can filter history as a string with / key and as a regular expression with * key.