update dependency install to 1.2

This commit is contained in:
a-sansara 2018-12-22 17:42:37 +01:00
parent 17a86492d7
commit 8da17aa8c5
3 changed files with 105 additions and 38 deletions

View File

@ -1,7 +1,7 @@
[project]
vendor = bes
name = config
version = 1.1
version = 1.2
license = "GNU GPL v3"
author = a-Sansara
type = application
@ -10,6 +10,4 @@ description = "bes-config is a small bash bes config display application"
keywords = "bash, bes, config"
[require]
bes.ini = 1.1
bes.echo = 1.2
bes.install = 1.1
bes.install = 1.2

135
dist/bes-config vendored
View File

@ -1,5 +1,31 @@
#!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_BOOT=
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function bes.exists () {
declare -f $1 > /dev/null
#~ [ x$(type -t $1) = xfunction ];
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function bes.boot ()
{
for fn in $BES_BOOT; do
if bes.exists $fn.boot; then
$fn.boot
fi
done
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function bes.reg ()
{
local sep=" "
if [ -z "$BES_BOOT" ]; then
sep=""
fi
BES_BOOT=$BES_BOOT$sep$1
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-color
# @app bes-color
@ -10,52 +36,67 @@
function bes.color.boot () {
BES_NOCOLOR=${BES_NOCOLOR:-0}
if [ "$BES_NOCOLOR" -eq 0 ]; then
# by convention all colors begins with 'C' uppercase
# followed by a name in lowercase
# background foreground
# R G B R G B
color.set "Chead" 53 114 160 195 223 255
color.set "Cheadsep" 53 114 160 252 212 102
# background
# R G B
color.bg "Cdone" 63 172 138
color.bg "Cfail" 172 63 85
# foreground
# R G B
color.fg "Ctitle" 133 92 181
color.fg "Cheadline" 22 74 133
color.fg "Csep" 80 80 80
color.fg "Cerr" 194 48 64
color.fg "Cval" 255 175 95
color.fg "Ckey" 40 168 134
color.fg "Caction" 106 183 241
color.fg "Csymbol" 255 175 95
color.fg "Citem" 92 147 181
color.fg "Cusa" 255 172 0
color.fg "Cspe" 255 214 166
color.fg "Copt" 94 215 255
color.fg "Ccom" 175 135 175
color.fg "Ctext" 0 132 101
color.fg "Cmeta" 39 100 170
color.load
if [ $? -eq 1 ]; then
# by convention all colors begins with 'C' uppercase
# followed by a name in lowercase
# but in this calls you dont need to prefix names
#
# background foreground
# R G B R G B
color.set "head" 53 114 160 195 223 255
color.set "headsep" 53 114 160 252 212 102
# background
# R G B
color.bg "done" 63 172 138
color.bg "fail" 172 63 85
# foreground
# R G B
color.fg "title" 133 92 181
color.fg "headline" 22 74 133
color.fg "sep" 80 80 80
color.fg "err" 194 48 64
color.fg "val" 255 175 95
color.fg "key" 40 168 134
color.fg "action" 106 183 241
color.fg "symbol" 255 175 95
color.fg "item" 92 147 181
color.fg "usa" 255 172 0
color.fg "spe" 255 214 166
color.fg "opt" 94 215 255
color.fg "com" 175 135 175
color.fg "text" 0 132 101
color.fg "meta" 39 100 170
echo -e "$Cerr warning ${Coff}cannot load colors config file"
fi
Coff="\\033[m"
fi
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function color.fg()
{
local -n var=$1
local s=${1}
if [ ${s:0:1} = "C" ]; then s=${s:1}; fi
s=${s,,}
local -n var=C$1
var="\033[1;38;2;$2;$3;$4m"
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function color.bg()
{
local -n var=$1
local s=${1}
if [ ${s:0:1} = "C" ]; then s=${s:1}; fi
s=${s,,}
local -n var=C$1
var="\033[1;48;2;$2;$3;$4m"
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function color.set()
{
local -n var=$1
local s=${1}
if [ ${s:0:1} = "C" ]; then s=${s:1}; fi
s=${s,,}
local -n var=C$1
var="\033[1;48;2;$2;$3;$4;1;38;2;$5;$6;$7m"
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -96,7 +137,30 @@ function color.env () {
var=${!v}
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.color.boot
function color.load () {
local file=${1:-/usr/share/bes/colors.ini}
if [ -f "$file" ]; then
local prefix="bes_colors"
bes.ini "$file" -p "$prefix" -b 1
for name in ${bes_colors_ALL_VARS}; do
key="${name:${#prefix}+1}"
if [ "${key:0:2}" = "fg" ]; then
color.fg "${key:3}" ${!name}
elif [ "${key:0:2}" == "bg" ]; then
color.bg "${key:3}" ${!name}
elif [ "${key:0:3}" == "set" ]; then
color.set "${key:4}" ${!name}
fi
done
else
return 1
fi
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
declare -f bes.reg > /dev/null
if [ $? -eq 0 ]; then
bes.reg bes.color
fi
#
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-echo
# @app bes-echo
@ -193,7 +257,10 @@ function echo.app ()
echo.sepline
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.boot
declare -f bes.reg > /dev/null
if [ $? -eq 0 ]; then
bes.reg bes.echo
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-echo
@ -575,6 +642,8 @@ function bes.usage ()
echo -e "${Coff}"
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.boot
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-config
# @app bes-config
@ -582,7 +651,7 @@ function bes.usage ()
# @date 2017-06-16 04:38:52 CET
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_VERSION=1.1
BES_VERSION=1.2
BES_NAME="bes-config"
BES_URL="https://git.pluie.org/meta-tech/$BES_NAME/raw/latest/dist/$BES_NAME"
APP_DIR=$(pwd)

View File

@ -7,7 +7,7 @@
# @date 2017-06-16 04:38:52 CET
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_VERSION=1.1
BES_VERSION=1.2
BES_NAME="bes-config"
BES_URL="https://git.pluie.org/meta-tech/$BES_NAME/raw/latest/dist/$BES_NAME"
APP_DIR=$(pwd)