diff options
author | johannst <stoelp@eit.uni-kl.de> | 2018-04-04 19:20:49 +0900 |
---|---|---|
committer | johannst <stoelp@eit.uni-kl.de> | 2018-04-04 19:20:49 +0900 |
commit | 381f772e05102fbd12b59bcc9aea4d2c88b92f17 (patch) | |
tree | 46ae5c141afe7a5523d0b90ff2057f743bec1d2a /bashrc | |
parent | f07e889cbd2de415dad2c3921350b00d451c37cb (diff) | |
download | dotfiles-381f772e05102fbd12b59bcc9aea4d2c88b92f17.tar.gz dotfiles-381f772e05102fbd12b59bcc9aea4d2c88b92f17.zip |
renamed colored printers in bashrc and factorized function to print final line
Diffstat (limited to 'bashrc')
-rw-r--r-- | bashrc | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -123,20 +123,29 @@ export LS_COLORS='di=94:ln=96:or=96;41:so=0:pi=0:ex=01;92:bd=0;42:cd=0;42:su=0:s #}}} #{{{ colored printers - function info() { +function pline() { + local col=$1 + local tag=$2 + local msg=$3 + echo -e "$col[$tag]: $msg${BCol_NoColor}" +} + function pinfo() { local msg=$1 - echo -e "${BCol_BrightGreen}[INFO]: ${msg}${BCol_NoColor}" + local tag=${2:-INFO} + pline ${BCol_BrightGreen} $tag ${msg} } - function warn () { + function pwarn () { local msg=$1 - echo -e "${BCol_YellowOrange}[WARN]: ${msg}${BCol_NoColor}" + local tag=${2:-WARN} + pline ${BCol_YellowOrange} $tag ${msg} } - function err() { + function perr() { local msg=$1 local exit=${2:-exit} - echo -e "${BCol_BrightRed}[ERR]: ${msg}${BCol_NoColor}" + local tag=${3:-ERR} + pline ${BCol_BrightRed} $tag ${msg} [[ "$exit" == "exit" ]] && exit 1 || return 0 } |