zshlibs/global.funcs.zsh
2022-01-11 20:41:35 +03:00

64 lines
1.2 KiB
Bash

typeset -g globaldots_path="${HOME}/.global"
if [[ -a $(realpath -m $(dirname $0)/../../.globaldir ) ]]
then
typeset -g globaldots_path=$(realpath -m $(dirname $0)/../../)
fi
if [[ -n ${GLOBALDOTS_PATH} ]]
then
typeset -g globaldots_path=${GLOBALDOTS_PATH}
fi
if [[ -z $globaldots_path ]]; then
echo 'functions require $globaldots_path to be set!'
fi
# ZCONFIG
## stuff for global dotfiles
function global_path_expand()
{
local bin_base=${globaldots_path}/bin
for pathnew in ${*}; do
zshlibs_path_add "${bin_base}/${pathnew}"
done;
}
function global_fpath_expand()
{
local bin_base=${globaldots_path}/bin
for pathnew in ${*}; do
zshlibs_fpath_add "${bin_base}/${pathnew}"
done;
}
function global_set_useropts()
{
typeset -a -g path_extra
}
function global_configure()
{
typeset -a -g path_extra
}
function global_config_setup()
{
zshlibs_log global "expanding path with '$path_extra'"
global_path_expand $path_extra
zshlibs_log global "expanding fpath with '$fpath_extra'"
global_fpath_expand vanilla
zshlibs_log global "done loading noninteractive config"
}
function global_boot()
{
global_configure
global_config_setup
}
## normal functions