refactorings

This commit is contained in:
accel 2022-01-11 18:20:34 +03:00
parent 192d9fccd6
commit fde1305d96

View File

@ -45,12 +45,12 @@ function zshlibs_ensure()
case $typ in
-d)
mkdir -p ${target} \
|| zshlibs_log zshlibs_ensure "unable to create directory '${target}'" \
|| zshlibs_log $0 "unable to create directory '${target}'" \
&& return 2
;;
-f)
touch ${target} \
|| zshlibs_log zshlibs_ensure "unable to create file '${target}'" \
|| zshlibs_log $0 "unable to create file '${target}'" \
&& return 2
esac
zshlibs_log zshlibs_ensure "target '${target}' created"
@ -95,17 +95,15 @@ function zshlibs_fpath_add()
path+=(${fpathtoadd})
fi
}
##### CONFIGURATION LIBRARIES
##### GLOBAL BUCKET STUFF
function global_path_expand()
{
local bin_base=${globaldots_path}/bin
for pathnew in ${*}; do
if [[ ! ${path[(r)${pathnew}]} ]] ; then
path+=(${bin_base}/${pathnew});
fi
zshlibs_path_add "${bin_base}/${pathnew}"
done;
}
@ -113,12 +111,11 @@ function global_fpath_expand()
{
local bin_base=${globaldots_path}/bin
for pathnew in ${*}; do
if [[ ! ${fpath[(r)${pathnew}]} ]] ; then
fpath+=${bin_base}/${pathnew}
fi
zshlibs_fpath_add "${bin_base}/${pathnew}"
done;
}
##### CONFIGURATION
function zconfig_checkload()
@ -146,16 +143,17 @@ function zconfigs_load()
function zconfigs_local_load()
{
if [[ ! -a ${zconfig_local_path} ]]; then
mkdir -p -m 700 ${zconfig_local_path}
cp ${zconfig_shared_path}/zshconfig.example ${zconfig_local_path}/local.config.zsh
fi
if [[ ! -d ${zconfig_local_path} ]]; then
zconfig_checkload ${zconfig_local_path}
else
zconfigs_load ${zconfig_local_path}/*.config.zsh;
fi
if [[ ! -a ${zconfig_local_path} ]]; then
zshlibs_log $0 "local config missing, recreating from '${zconfig_shared_path}/zshconfig.example'"
mkdir -p -m 700 ${zconfig_local_path}
cp ${zconfig_shared_path}/zshconfig.example ${zconfig_local_path}/local.config.zsh
fi
if [[ ! -d ${zconfig_local_path} ]]; then
zshlibs_log zconfigs ""
zconfig_checkload ${zconfig_local_path}
else
zconfigs_load ${zconfig_local_path}/*.config.zsh;
fi
}