From 4715b79aee2d3d3a137c96fbc2c02ec6d4a15041 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Thu, 30 Apr 2020 11:36:42 +0200 Subject: [PATCH] Added colors --- sd_setup.sh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/sd_setup.sh b/sd_setup.sh index 05d676f..07af950 100644 --- a/sd_setup.sh +++ b/sd_setup.sh @@ -7,16 +7,32 @@ echo "@author Kevin Veen-Birkenbach [kevin@veen.world]" echo "@since 2017-03-12" echo +# Define colors +red_color=`tput setaf 1` +green_color=`tput setaf 2` +yellow_color=`tput setaf 3` +blue_color=`tput setaf 4` +magenta_color=`tput setaf 5` +reset_color=`tput sgr0` + +message(){ + echo "$1[$2]:${reset_color} $3 "; +} + question(){ - echo "[QUESTION]: $1"; + message "${magenta_color}" "QUESTION" "$1"; } info(){ - echo "[INFO]: $1"; + message "${blue_color}" "INFO" "$1"; } warning(){ - echo "[WARNING]: $1"; + message "${yellow_color}" "WARNING" "$1"; +} + +success(){ + message "${green_color}" "SUCCESS" "$1"; } destructor(){ @@ -26,7 +42,7 @@ destructor(){ } error(){ - echo "[ERROR]: $1 -> Leaving program." + message "${red_color}" "ERROR" "$1 -> Leaving program." destructor exit 1; } @@ -310,4 +326,4 @@ info "The first level folder structure on $root_mount_path is now:" && tree -laL info "The first level folder structure on $boot_mount_path is now:" && tree -laL 1 "$boot_mount_path" destructor -info "Setup successfull :)" && exit 0 +success "Setup successfull :)" && exit 0