docker-images/pluie/alpine/util.sh

41 lines
1.1 KiB
Bash
Raw Normal View History

2016-07-25 00:28:26 +00:00
#!/bin/bash
2016-08-06 00:29:06 +00:00
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
2016-07-25 00:28:26 +00:00
2016-07-25 02:35:21 +00:00
function bash_prompt() {
local Cenvcode="243"
2016-07-25 02:35:21 +00:00
if [ "$SHENV_CTX" = "INT" ]; then
local Cenvcode="202"
2016-07-25 02:35:21 +00:00
elif [ "$SHENV_CTX" = "PROD" ]; then
local Cenvcode="160"
2016-07-25 02:35:21 +00:00
fi
local Cdate="\[\033[1;33m\]"
local Cctx="\[\033[1;48;5;${Cenvcode}m\]"
local Cname="\[\033[1;48;5;${SHENV_COLOR}m\]"
local Cpath="\[\033[1;38;5;36m\]"
local Cwhite="\[\033[1;38;5;15m\]"
local Chost="\[\033[1;38;5;15m\]"
local Csymbol="\[\033[1;38;5;15m\]"
local Cuser="\[\033[1;38;5;203m\]"
local Coff="\[\033[m\]"
2016-08-06 15:37:41 +00:00
export PS1="${Cdate}\t ${Cwhite}${Cctx} DOCKER ${SHENV_CTX} ${Cname} ${SHENV_NAME} ${Coff} ${Cuser}\u${Chost}@\h ${Cpath}\w ${Csymbol}\$ ${Coff}"
2016-07-25 02:35:21 +00:00
}
2016-08-04 01:00:33 +00:00
function initTitle(){
local data=${1:-''}
if [ ! -z "$2" ]; then
data="$data\033[1;38;5;97m $2 "
fi
echo -e "\n\033[1;33m[[ \033[1;38;5;30m$data\033[1;33m]]\033[m"
}
2016-07-25 00:28:26 +00:00
function preInit(){
for i in ls $1/*.sh
do
if [ -e "${i}" ]; then
2016-08-04 01:00:33 +00:00
initTitle "Processing" "$i"
2016-07-25 00:28:26 +00:00
. "${i}"
fi
done
}