adds different styles for term or no term

This commit is contained in:
2019-05-15 13:43:51 +02:00
parent a9775f4d9b
commit bcdfeb6f88

30
main.sh
View File

@@ -1,10 +1,24 @@
#!/usr/bin/env bash
# Configure styling
if [[ -n "$TERM" ]]
then
inverse="$(tput setab 7)$(tput setaf 0)"
success="$(tput setab 2)$(tput bold)"
error="$(tput setab 1)$(tput bold)"
underline=$(tput smul)
bold="$(tput bold)"
success="$(tput setab 2)$bold"
info="$(tput setaf 6)$bold"
warning="$(tput setaf 3)$bold"
error="$(tput setab 1)$bold"
reset=$(tput sgr0)
else
inverse=""
bold="[["
success="[["
info="[["
warning="[["
error="[["
reset="]]"
fi
export BOG_TITLE_PRINTED=0
@@ -46,7 +60,7 @@ footer () {
section () {
read title
echo ":::::"
echo ":(*) $title..."
echo ":$bold(*) $title...$reset"
}
result () {
@@ -54,9 +68,9 @@ result () {
if [ $exit_code -eq 0 ]
then
echo ":)=> $success Ok $reset ****"
echo ":)=> $success Ok $reset"
else
echo ":(!> $error Error $reset ****"
echo ":(!> $error Error $reset"
fi
}
@@ -71,13 +85,13 @@ output () {
output::warning () {
while read line
do
echo ":::<!> $line"
echo ":::$warning<!>$reset $line"
done
}
output::info () {
while read line
do
echo ":::<?> $line"
echo ":::$info<?>$reset $line"
done
}