This repository has been archived on 2024-09-06. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
debian-updater/lib/messages.sh
2018-04-27 16:13:59 +02:00

38 lines
752 B
Bash

#/bin/bash
#
# message ()
# ----------
#
# External library to display colored messages
#
message () {
local red=$'\e[1;31m'
local grn=$'\e[1;32m'
local yel=$'\e[1;33m'
local blu=$'\e[1;34m'
local mag=$'\e[1;35m'
local cyn=$'\e[1;36m'
local end=$'\e[0m'
case $2 in
"err")
printf "%s${1}%s" "${red}" "${end}"
exit 1
;;
"warn")
printf "%s${1}%s" "${yel}" "${end}"
;;
"ok")
printf "%s${1}%s" "${grn}" "${end}"
;;
"bold")
printf "\e[1m${1}%s" "${end}"
;;
"info")
printf "%s${1}%s" "${mag}" "${end}"
;;
*)
printf "${1}"
esac
}