mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 04:46:19 +10:00
Check for tput
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
which tput &> /dev/null
|
||||
if [[ "$?" == "0" ]]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
else
|
||||
echo "ERROR: $1" >&2
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
display_fatal() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
which tput &> /dev/null
|
||||
if [[ "$?" == "0" ]]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
else
|
||||
echo "ERROR: $1" >&2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
display_message() {
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
which tput &> /dev/null
|
||||
if [[ "$?" == "0" ]]; then
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
display_warning() {
|
||||
# YELLOW!
|
||||
tput sgr0
|
||||
tput setaf 3
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
which tput &> /dev/null
|
||||
if [[ "$?" == "0" ]]; then
|
||||
# YELLOW!
|
||||
tput sgr0
|
||||
tput setaf 3
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user