Doesn't support configurable intervals (and other watch options).
Looking at the code, this implementation of watch only has an interval of 1 second. For commands that are heavy on resources, that's too frequent.
In normal (gnu?) watch you can set an interval and other options :
/usr/bin/watch --help
Usage:
watch [options] command
Options:
-b, --beep beep if command has a non-zero exit
-c, --color interpret ANSI color and style sequences
-d, --differences[=<permanent>]
highlight changes between updates
-e, --errexit exit if command has a non-zero exit
-g, --chgexit exit when output from command changes
-n, --interval <secs> seconds to wait between updates
-p, --precise attempt run command in precise intervals
-t, --no-title turn off header
-x, --exec pass command to exec instead of "sh -c"
-h, --help display this help and exit
-v, --version output version information and exit
For more details see watch(1).
It would be good to have those implemented. Also, amusingly watch --help in this implementation tries to watch a command --help. The experienced unix admin knows that to pass arguments to apps they have to push a -- separator, so watch -c -n30 -- ls -c but if you do this, be sure to document :-)
What about watch 30s command name?
I'd recommend using flag or cobra flags to try and match the options in the current watch command as you'll get more adoption if it's a drop-in replacement. Then you can also map WATCH_COMMAND to -x.
I just found this, and I'm interested in the same thing. I could submit a PR for this if you like?
Okay 👌
I'll submit a PR to introduce optional flags, and include the interval flag. That should at least be enough to then get started on adding other flags