silent-modus eingebaut

This commit is contained in:
bernd 2021-05-29 00:04:22 +02:00
parent e7b2d5bd69
commit 1ae6b0525c

View file

@ -51,7 +51,7 @@ fi
PROGRAMM_NAME=`basename $0`
PROGRAMM_VERSION="0.0.1"
#VERBOSITY=0
VERBOSITY=1
STY_HOME="$HOME/texmf/tex/latex"
STY_RECHNUNG="rechnung.sty"
STY_URL="https://github.com/tomka/rechnung"
@ -92,28 +92,40 @@ print_start() {
msg=$*
if [ "$COLORED_OUTPUT" -eq 1 ]; then
printf "%s[+]%s %s" "$GREEN" "$NORMAL" "$msg"
if [ "$VERBOSITY" -eq 0 ]; then
return
else
printf " Failed"
if [ "$COLORED_OUTPUT" -eq 1 ]; then
printf "%s[+]%s %s" "$GREEN" "$NORMAL" "$msg"
else
printf " Failed"
fi
fi
}
print_failed() {
if [ "$COLORED_OUTPUT" -eq 1 ]; then
printf "%s Failed%s\n" "$RED" "$NORMAL"
if [ "$VERBOSITY" -eq 0 ]; then
return
else
printf " Failed\n"
if [ "$COLORED_OUTPUT" -eq 1 ]; then
printf "%s Failed%s\n" "$RED" "$NORMAL"
else
printf " Failed\n"
fi
fi
}
print_ok() {
if [ "$COLORED_OUTPUT" -eq 1 ]; then
printf "%s OK%s\n" "$GREEN" "$NORMAL"
if [ "$VERBOSITY" -eq 0 ]; then
return
else
printf " OK\n"
if [ "$COLORED_OUTPUT" -eq 1 ]; then
printf "%s OK%s\n" "$GREEN" "$NORMAL"
else
printf " OK\n"
fi
fi
}
@ -121,10 +133,14 @@ print_deko() {
msg=$*
if [ "$COLORED_OUTPUT" -eq 1 ]; then
echo "${BLUE}${msg}${NORMAL}"
if [ "$VERBOSITY" -eq 0 ]; then
return
else
echo "$msg"
if [ "$COLORED_OUTPUT" -eq 1 ]; then
echo "${BLUE}${msg}${NORMAL}"
else
echo "$msg"
fi
fi
}
@ -132,10 +148,14 @@ print_info() {
msg=$*
if [ "$COLORED_OUTPUT" -eq 1 ]; then
echo "${GREEN}[+]$NORMAL $msg"
if [ "$VERBOSITY" -eq 0 ]; then
return
else
echo "[-] $msg"
if [ "$COLORED_OUTPUT" -eq 1 ]; then
echo "${GREEN}[+]$NORMAL $msg"
else
echo "[-] $msg"
fi
fi
}
@ -143,10 +163,14 @@ print_warn() {
msg=$*
if [ "$COLORED_OUTPUT" -eq 1 ]; then
echo "${YELLOW}[-]$NORMAL $msg"
if [ "$VERBOSITY" -eq 0 ]; then
return
else
echo "[-] $msg"
if [ "$COLORED_OUTPUT" -eq 1 ]; then
echo "${YELLOW}[-]$NORMAL $msg"
else
echo "[-] $msg"
fi
fi
}
@ -433,12 +457,13 @@ quit() {
# --------------------- #
# CLI Optionen auswerten
while getopts f:hl:v opt
while getopts f:hl:qv opt
do
case $opt in
f) RECHNUNGSFILE=$OPTARG;;
h) display_help; exit 0;;
l) LCOFILE=$OPTARG;;
q) VERBOSITY=0;;
v) display_version; exit 0;;
*) display_help; exit 1;;
esac