few improvements, consistency fixes

This commit is contained in:
levasseur
2021-10-06 17:55:04 +02:00
parent a1372a5d50
commit ee3a8d91ba
2 changed files with 20 additions and 12 deletions

View File

@@ -79,13 +79,16 @@ show_version()
local mod=
for mod in $MYPATH/modules/*.sh; do
. $mod
local modname=$(get_mod_name $mod)
local version=VER_$modname
# Ran in a subshell to not pollute environment
(
. $mod
local modname=$(get_mod_name $mod)
local version=VER_$modname
echo -e "\t$BWhite$modname${DEFAULTCOL}: $BGreen${!version}$DEFAULTCOL"
echo -e "\t$BWhite$modname${DEFAULTCOL}: $BGreen${!version}$DEFAULTCOL"
unset modname version
unset modname version
)
done
unset mod
@@ -100,6 +103,10 @@ export -f show_version
# Get module name from module file
get_mod_name()
{
if [[ $# -ne 1 ]] then
prnt E "get_mod_name(): Bad number of parameters."
die 11 --force
fi
echo $(basename $1 | cut -f 1 -d '.')
}
export -f get_mod_name