paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 2223ac8604577f4432a51bf3637f4b68a2d4a18c
parent b9030a7fcd9a3937cfe893e16f69b76ef94d2f80
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Sat, 23 May 2020 19:36:59 -0400

Switch tputs to ANSI escape colour codes

ANSI escape codes are more portable than tput, will work on nearly every
terminal/terminal-emulator.

Diffstat:
Mcompile | 21++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/compile b/compile @@ -38,6 +38,12 @@ if [ ! -x "$(command -v pandoc)" ]; then exit 1 fi +# Define colours +CLEAR="\033[0m" +RED="\033[0;31m" +GREEN="\033[0;32m" +YELLOW="\033[0;33m" + # The name of the site in the <title> tags siteName="paritybit.ca" # Set to "false" to disable auto-upload @@ -66,32 +72,25 @@ fi # Prints the message passed as the 1st argument in red. print_error_msg() { - tput sgr0; tput setaf 1 - printf "[ee] %s\n" "$1" - tput sgr0 + printf "${RED}[ee] %s\n${CLEAR}" "$1" } # Prints the message passed as the 1st argument in green. print_success_msg() { - tput sgr0; tput setaf 2 - printf "[ok] %s\n" "$1" - tput sgr0 + printf "${GREEN}[ok] %s\n${CLEAR}" "$1" } # Prints the message passed as the 1st argument in yellow. print_header_msg() { - tput sgr0; tput setaf 3 - printf "[hh] %s\n" "$1" - tput sgr0 + printf "${YELLOW}[hh] %s\n${CLEAR}" "$1" } # Prints the message passed as the 1st argument with default colours. print_info_msg() { - tput sgr0 - printf "[ii] %s\n" "$1" + printf "${CLEAR}[ii] %s\n" "$1" } auto_upload()