enhance display + add bes.main fn
This commit is contained in:
parent
68abf31b41
commit
b1acee5292
|
@ -7,12 +7,14 @@ BES_TERM_WIDTH=105
|
||||||
if [ "$BES_NOCOLOR" -eq 0 ]; then
|
if [ "$BES_NOCOLOR" -eq 0 ]; then
|
||||||
Cok="\033[0;38;5;37m"; Cko="\033[0;38;5;217m"
|
Cok="\033[0;38;5;37m"; Cko="\033[0;38;5;217m"
|
||||||
Coff="\033[m"; Ctitle="\033[1;48;5;23;1;38;5;15m"
|
Coff="\033[m"; Ctitle="\033[1;48;5;23;1;38;5;15m"
|
||||||
|
Cdone="\033[1;48;5;36;1;38;5;15m"; Cfail="\033[1;48;5;196;1;38;5;15m"
|
||||||
Cspe="\033[1;38;5;223m"; Citem="\033[1;38;5;214m"
|
Cspe="\033[1;38;5;223m"; Citem="\033[1;38;5;214m"
|
||||||
Cval="\033[1;38;5;215m"; Cusa="\033[1;38;5;214m"
|
Cval="\033[1;38;5;215m"; Cusa="\033[1;38;5;214m"
|
||||||
Cbra="\033[1;38;5;203m"; Crepo="\033[1;38;5;223m"
|
Cbra="\033[1;38;5;203m"; Crepo="\033[1;38;5;223m"
|
||||||
Cmeta="\033[1;38;5;30m"; Ctext="\033[1;38;5;30m"
|
Cmeta="\033[1;38;5;30m"; Ctext="\033[1;38;5;30m"
|
||||||
Copt="\033[1;38;5;81m"; Csep="\033[1;38;5;241m"
|
Copt="\033[1;38;5;81m"; Csep="\033[1;38;5;241m"
|
||||||
Cerr="\033[1;38;5;196m"; Ccom="\033[0;38;5;139m"
|
Cerr="\033[1;38;5;196m"; Ccom="\033[0;38;5;139m"
|
||||||
|
Csection="\033[1;38;5;97m";
|
||||||
fi
|
fi
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
bes.echo(){
|
bes.echo(){
|
||||||
|
@ -40,6 +42,11 @@ bes.echo.action(){
|
||||||
bes.echo "$1" 1
|
bes.echo "$1" 1
|
||||||
}
|
}
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
bes.echo.title(){
|
||||||
|
bes.echo " ${Cspe}☪ ${Csection}$1 ${Copt}$2${Coff}"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
bes.echo.keyval(){
|
bes.echo.keyval(){
|
||||||
local c=': '
|
local c=': '
|
||||||
if [ ! "$BES_NOCOLOR" = 1 ]; then
|
if [ ! "$BES_NOCOLOR" = 1 ]; then
|
||||||
|
@ -49,10 +56,12 @@ bes.echo.keyval(){
|
||||||
}
|
}
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
bes.echo.state(){
|
bes.echo.state(){
|
||||||
|
local len=8
|
||||||
|
printf "%0.s " $(seq 1 $(($BES_TERM_WIDTH-${len})))
|
||||||
if [ "$1" = 0 ]; then
|
if [ "$1" = 0 ]; then
|
||||||
echo " done !"
|
echo -e "${Cdone} OK ${Coff}"
|
||||||
else
|
else
|
||||||
echo " fail !"
|
echo -e "${Cfail} KO ${Coff}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
18
src/main.sh
18
src/main.sh
|
@ -8,10 +8,11 @@ bes.title 'bes-build' $BES_BUILD_VERSION
|
||||||
APP_NAME=$(basename $(pwd))
|
APP_NAME=$(basename $(pwd))
|
||||||
APP_BIN=$APP_DIR/dist/$APP_NAME
|
APP_BIN=$APP_DIR/dist/$APP_NAME
|
||||||
|
|
||||||
echo
|
bes.main(){
|
||||||
bes.echo " ${Cspe}building project ${Copt}$APP_NAME${Coff}" 0
|
|
||||||
echo
|
echo
|
||||||
if [ -d "$APP_DIR/src" ]; then
|
bes.echo.title "building project" "$APP_NAME"
|
||||||
|
if [ -d "$APP_DIR/src" ]; then
|
||||||
if [ ! -d "$APP_DIR/dist" ]; then
|
if [ ! -d "$APP_DIR/dist" ]; then
|
||||||
bes.echo.action "creating dist directory"
|
bes.echo.action "creating dist directory"
|
||||||
mkdir $APP_DIR/dist
|
mkdir $APP_DIR/dist
|
||||||
|
@ -38,8 +39,11 @@ if [ -d "$APP_DIR/src" ]; then
|
||||||
bes.echo.action "set execution mode"
|
bes.echo.action "set execution mode"
|
||||||
chmod +x $APP_BIN
|
chmod +x $APP_BIN
|
||||||
bes.echo.state $?
|
bes.echo.state $?
|
||||||
else
|
else
|
||||||
bes.echo.error "no src/ directory. exit"
|
bes.echo.error "no src/ directory. exit"
|
||||||
bes.echo.state 1
|
bes.echo.state 1
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
bes.main $*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user