Unify scripts by using a common color / function framework

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-09-19 12:10:53 +02:00
parent a9570cde04
commit eeb4ba2d79
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
5 changed files with 24 additions and 34 deletions

View file

@ -3,12 +3,7 @@
set -o pipefail
set -e
STEP_COLOR="\033[0;36m"
NO_COLOR="\033[0m"
function step {
echo -e ${STEP_COLOR}[$(date +%H:%M:%S)] $1${NO_COLOR}
}
source "${HOME}/bin/script_framework.sh"
### Fix committer email by repo

View file

@ -3,12 +3,7 @@
set -o pipefail
set -e
STEP_COLOR="\033[0;36m"
NO_COLOR="\033[0m"
function step {
echo -e ${STEP_COLOR}[$(date +%H:%M:%S)] $1${NO_COLOR}
}
source "${HOME}/bin/script_framework.sh"
### Determine what to push

View file

@ -3,12 +3,7 @@
set -o pipefail
set -e
STEP_COLOR="\033[0;36m"
NO_COLOR="\033[0m"
function step {
echo -e ${STEP_COLOR}[$(date +%H:%M:%S)] $1${NO_COLOR}
}
source "${HOME}/bin/script_framework.sh"
step "Loading required keys to pull"
git loadkey

20
bin/script_framework.sh Normal file
View file

@ -0,0 +1,20 @@
COLOR_RED="\033[0;31m"
COLOR_GREEN="\033[0;32m"
COLOR_CYAN="\033[0;36m"
COLOR_PLAIN="\033[0m"
function error {
echo -e "${COLOR_RED}$@${COLOR_PLAIN}"
}
function success {
echo -e "${COLOR_GREEN}$@${COLOR_PLAIN}"
}
function info {
echo -e "${COLOR_CYAN}$@${COLOR_PLAIN}"
}
function step {
info "[$(date +%H:%M:%S)] $@"
}

View file

@ -3,22 +3,7 @@
set -e
set -o pipefail
COLOR_RED="\033[0;31m"
COLOR_GREEN="\033[0;32m"
COLOR_CYAN="\033[0;36m"
COLOR_PLAIN="\033[0m"
function error {
echo -e "${COLOR_RED}$@${COLOR_PLAIN}"
}
function success {
echo -e "${COLOR_GREEN}$@${COLOR_PLAIN}"
}
function info {
echo -e "${COLOR_CYAN}$@${COLOR_PLAIN}"
}
source "${HOME}/bin/script_framework.sh"
if ! ( which vault > /dev/null ); then
error "vault is required."