cwtch is a watch(1)
with configurable highlighting. It implements a subset of the options available in watch(1)
.
Install cwtch
from your command line using go install
:
go install github.com/fraugster/cwtch@latest
The default configuration file is ~/.cwtch.yml
. You can provide alternative configuration through the --config
option.
Alternatively, you can also use multiple configuration files by putting them all in a common configuration directory ~/.cwtch
. This
configuration directory is configurable through the --config-dir
option. Only one of these configuration files will be
chosen, depending on a logic described below.
Here is an example file of some configuration:
cmd_regex: kubectl
highlights:
- regex: Completed|Succeeded|Bound|Released
fg: blue, bold
bg: white
highlights
is a list of items. Each item configures a highlighting regular
expression. The regular expression is provided in regex
. Any text matched in
the command output is highlighted using the provided colours. In this case, the
foreground colour is set to blue
and bold
, while the background is set to
white
. If fg
or bg
is omitted, the default colour is used. Any colour can
only be used. Attributes are optional and can be combined with each other.
The optional attribute cmd_regex
defines a regular expression. If this attribute
is set, then the highlights associated with it will only be applied if the regular
expression matches the provided command. This is useful when using multiple
configuration files: when executing a command, cwtch
will search through all
configuration files and will choose the first configuration file (sorted alphanumerically)
either has no cmd_regex
set or whose cmd_regex
matches the command that gets
executed. If ~/.cwtch.yml
is present, it will always be evaluated last.
List of available colours:
black
red
green
yellow
blue
magenta
cyan
white
List of available attributes:
bold
underline
reverse
italic
blink
dim
strikethrough
For more examples, have a look at the examples/
subdirectory.
If you want to hack on this repository, please read the short CONTRIBUTING.md guide first.
We use SemVer for versioning. For the versions, available, see the tags on this repository.
- Andreas Krennmair - Initial work akrennmair
See also the list of contributors who participated in this project.
This project is licensed under the Apache-2 license - see the LICENSE file for details.