From f07e889cbd2de415dad2c3921350b00d451c37cb Mon Sep 17 00:00:00 2001 From: johannst Date: Wed, 4 Apr 2018 17:29:18 +0900 Subject: added colored printer in bashrc --- bashrc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index c02002b..b4704bf 100644 --- a/bashrc +++ b/bashrc @@ -113,7 +113,7 @@ function pwd_formater() { export PS1="\[${BCol_BrightRed}\]::\[${BCol_MediumGray}\]\u\[${BCol_BrightRed}\]::\[${BCol_LightGray}\]\H\[${BCol_BrightRed}\]:\[${BCol_DarkGray}\]$(tty) \[${BCol_LightGray}\] - \[${BCol_DarkBlue}\]\w\n\ \[${BCol_NoColor}\][\$(ret=\$?; if [[ \$ret == 0 ]]; then echo \"\[${BCol_BrightGreen}\]\$ret\"; else echo \"\[${BCol_BrightRed}\]\$ret\"; fi)\[${BCol_NoColor}\]] \$> " -export PROMPT_COMMAND="echo -e ''" +#$export PROMPT_COMMAND="echo -e ''" #}}} #{{{ ls colors @@ -121,3 +121,23 @@ export PROMPT_COMMAND="echo -e ''" 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:sg=0:tw=30;44:ow=30;44' #}}} +#{{{ colored printers + + function info() { + local msg=$1 + echo -e "${BCol_BrightGreen}[INFO]: ${msg}${BCol_NoColor}" + } + + function warn () { + local msg=$1 + echo -e "${BCol_YellowOrange}[WARN]: ${msg}${BCol_NoColor}" + } + + function err() { + local msg=$1 + local exit=${2:-exit} + echo -e "${BCol_BrightRed}[ERR]: ${msg}${BCol_NoColor}" + [[ "$exit" == "exit" ]] && exit 1 || return 0 + } + + #}}} -- cgit v1.2.3