From cdf26bc084a72ff5ab7ded2c695c7932fa8ded4c Mon Sep 17 00:00:00 2001 From: Artus Date: Mon, 13 May 2019 13:44:59 +0200 Subject: [PATCH] adds main.sh --- main.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 main.sh diff --git a/main.sh b/main.sh new file mode 100644 index 0000000..0dc8e13 --- /dev/null +++ b/main.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +inverse="$(tput setab 7)$(tput setaf 0)" +success="$(tput setab 2)$(tput bold)" +error="$(tput setab 1)$(tput bold)" +underline=$(tput smul) +reset=$(tput sgr0) + +# Set pipefail option +set -o pipefail + +title () { + read title + echo " ****" + echo "***** $title *****" + echo "*****" +} + +subtitle () { + read title + echo "***** $title" +} + +footer () { + echo "***** *****" + echo "***** END OF SCRIPT *****" + echo " **** ****" +} + +section () { + read title + echo ":" + echo ":<*> $title..." +} + +result () { + local exit_code=$? + + if [ $exit_code -eq 0 ] + then + echo ":<=> $success Ok $reset*****" + else + echo ": $error Error $reset*****" + fi +} + +output () { + while read line + do + #[ -z "$line" ] && break + echo ": | $line" + done +} + +output::warning () { + while read line + do + echo ": $line" + done +}