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