Build the project with Rust and can be built with cargo:
cargo build --release
After the build, the binary will be located in target/release/cout
. And for a easier use, you can add the binary to your PATH environment variable.
export PATH=$PATH:$(pwd)/target/release/cout
cout
can be used with any bash command, just pipe the output to cout and it will colorize it, for example:
ls -la | cout # Use the built-in default profile
cargo -V | cout info # Use the built-in info profile
nmap google.com | cout nmap # Use a custom profile
cout
has a default
built-in profile and a info
example of a custom profile which can be used as a template for your own custom profiles.
The profiles are located in the config
directory of your OS, for example:
# 🐧 Linux
~/.config/cout/
# 🍎 MacOS
~/Library/Application Support/cout/
# 🪟 Windows
%APPDATA%\cout\
And the profiles are written in TOML format, for example:
patterns = [
["[0-9]{4}-[0-9]{2}-[0-9]{2}", "blue"], # Dates
["[0-9]{2}:[0-9]{2}:[0-9]{2}", "brightblue"], # Time
["(DEBUG|INFO|WARN|ERROR|FATAL)", "black"], # Log levels
['''[0-9]+\.[0-9]+\.[0-9]+''', "green"], # SemVer
]
The
patterns
array is a list of regex patterns and colors, the colors can be any of the ANSI colors.
Note:
cout
is not a replacement for the original command, it just colorizes the output in a generic way for a better DX with broader compatibility.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.