It's a simple and tiny tool for getting colored output in scripts.
$ colout -h
A CLI tool that makes it easy to use colored output.
Usage:
colout [command]
Available Commands:
error colored red output
help Help about any command
info colored blue output
success colored green output
version Print the version number
warn colored yellow output
Flags:
-h, --help help for colout
Use "colout [command] --help" for more information about a command.
The subcommands specify the color, and the wording is passed as an argument or standard input.
colout success "Successfully done."
echo "Successfully done." | colout success
All of the above examples result in the following output.
#!/bin/bash
# do-your-work
if [ $? = 0 ]; then
colout success "Successfully done."
else
colout error "An error has occurred."
fi
# do-your-work
if ( $? ){
colout success "Successfully done."
}
else {
colout error "An error has occurred."
}
@echo off
rem do-your-work
if %errorlevel% == 0 (
colout success "Successfully done."
) else (
colout error "An error has occurred."
)
brew install kemokemo/tap/colout
First, add my scoop-bucket.
scoop bucket add kemokemo-bucket https://github.com/kemokemo/scoop-bucket.git
Next, install this app by running the following.
scoop install colout
go get github.com/kemokemo/colout
Download from the release page, unpack the archive and put the binary somewhere in your PATH
.