Created
January 15, 2019 19:26
-
-
Save san650/ba500d18179dddb9feb9b3df1d421052 to your computer and use it in GitHub Desktop.
Bash script to color tap output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| RED=$(printf "\033[31m") | |
| GREEN=$(printf "\033[32m") | |
| GRAY= | |
| CLOSING=$(printf "\033[m") | |
| function color_not_ok() { | |
| sed "/^not ok/{; s/^/${RED}/; s/$/${CLOSING}/; }" | |
| } | |
| function color_ok() { | |
| sed "/^ok/{; s/^/"${GREEN}"/; s/$/"${CLOSING}"/; }" | |
| } | |
| function color_debug() { | |
| sed "/^#/{; s/^/"${GRAY}"/; s/$/"${CLOSING}"/; }" | |
| } | |
| cat \ | |
| | color_not_ok \ | |
| | color_ok \ | |
| | color_debug |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
my-test-script | ./tap-color.sh