mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 07:25:10 +00:00
* add utils.sh and colorize messages Signed-off-by: Naser Mirzaei <nasermirzaei89@gmail.com> * rename utils to scriptUtils Signed-off-by: Naser Mirzaei <nasermirzaei89@gmail.com>
43 lines
715 B
Bash
Executable file
43 lines
715 B
Bash
Executable file
#!/bin/bash
|
|
|
|
C_RESET='\033[0m'
|
|
C_RED='\033[0;31m'
|
|
C_GREEN='\033[0;32m'
|
|
C_BLUE='\033[0;34m'
|
|
C_YELLOW='\033[1;33m'
|
|
|
|
# println echos string
|
|
function println() {
|
|
echo -e "$1"
|
|
}
|
|
|
|
# errorln echos i red color
|
|
function errorln() {
|
|
println "${C_RED}${1}${C_RESET}"
|
|
}
|
|
|
|
# successln echos in green color
|
|
function successln() {
|
|
println "${C_GREEN}${1}${C_RESET}"
|
|
}
|
|
|
|
# infoln echos in blue color
|
|
function infoln() {
|
|
println "${C_BLUE}${1}${C_RESET}"
|
|
}
|
|
|
|
# warnln echos in yellow color
|
|
function warnln() {
|
|
println "${C_YELLOW}${1}${C_RESET}"
|
|
}
|
|
|
|
# fatalln echos in red color and exits with fail status
|
|
function fatalln() {
|
|
errorln "$1"
|
|
exit 1
|
|
}
|
|
|
|
export -f errorln
|
|
export -f successln
|
|
export -f infoln
|
|
export -f warnln
|