cwtch

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

README

cwtch


cwtch is a watch(1) with configurable highlighting. It implements a subset of the options available in watch(1).

Getting Started

Install cwtch from your command line using go get:

go get github.com/fraugster/cwtch

Configuring highlighting

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.

Contributing

If you want to hack on this repository, please read the short CONTRIBUTING.md guide first.

Versioning

We use SemVer for versioning. For the versions, available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache-2 license - see the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL