Compare commits
2 Commits
d5faffd04c
...
31f67370ed
Author | SHA1 | Date | |
---|---|---|---|
31f67370ed | |||
c72676ccac |
@ -1,63 +0,0 @@
|
||||
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
|
||||
|
||||
|
18
global.zsh
Normal file
18
global.zsh
Normal file
@ -0,0 +1,18 @@
|
||||
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
|
||||
|
||||
autoload global_path_expand global_fpath_expand global_set_useropts \
|
||||
global_configure global_config_setup global_boot
|
||||
fpath+=(${zshlibs_install}/global)
|
5
global/global_boot
Normal file
5
global/global_boot
Normal file
@ -0,0 +1,5 @@
|
||||
function global_boot()
|
||||
{
|
||||
global_configure
|
||||
global_config_setup
|
||||
}
|
8
global/global_config_setup
Normal file
8
global/global_config_setup
Normal file
@ -0,0 +1,8 @@
|
||||
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"
|
||||
}
|
4
global/global_configure
Normal file
4
global/global_configure
Normal file
@ -0,0 +1,4 @@
|
||||
function global_configure()
|
||||
{
|
||||
typeset -a -g path_extra
|
||||
}
|
7
global/global_fpath_expand
Normal file
7
global/global_fpath_expand
Normal file
@ -0,0 +1,7 @@
|
||||
function global_fpath_expand()
|
||||
{
|
||||
local bin_base=${globaldots_path}/bin
|
||||
for pathnew in ${*}; do
|
||||
zshlibs_fpath_add "${bin_base}/${pathnew}"
|
||||
done;
|
||||
}
|
7
global/global_path_expand
Normal file
7
global/global_path_expand
Normal file
@ -0,0 +1,7 @@
|
||||
function global_path_expand()
|
||||
{
|
||||
local bin_base=${globaldots_path}/bin
|
||||
for pathnew in ${*}; do
|
||||
zshlibs_path_add "${bin_base}/${pathnew}"
|
||||
done;
|
||||
}
|
4
global/global_set_useropts
Normal file
4
global/global_set_useropts
Normal file
@ -0,0 +1,4 @@
|
||||
function global_set_useropts()
|
||||
{
|
||||
typeset -a -g path_extra
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
autoload zshlibs_boot zshlibs_log zshlibs_ensure zshlibs_fpath_add \
|
||||
zshlibs_path_add zshlibs_start zshlibs_update
|
||||
function zbootstrap()
|
||||
{
|
||||
autoload zshlibs_boot zshlibs_log zshlibs_ensure zshlibs_fpath_add \
|
||||
zshlibs_path_add zshlibs_start zshlibs_update
|
||||
zshlibs_start
|
||||
}
|
||||
|
@ -15,8 +15,7 @@ else
|
||||
zshlibs_update
|
||||
fi
|
||||
|
||||
|
||||
source ${zshlibs_install}/tools.zsh
|
||||
source ${zshlibs_install}/zconfig.funcs.zsh
|
||||
source ${zshlibs_install}/global.funcs.zsh
|
||||
source ${zshlibs_install}/zconfig.zsh
|
||||
source ${zshlibs_install}/global.zsh
|
||||
source ${zshlibs_install}/zssh.zsh
|
||||
|
@ -1,82 +0,0 @@
|
||||
|
||||
function zconfig_checkload()
|
||||
{
|
||||
typeset -a -g zconfig_loaded
|
||||
if [[ ! ${zconfig_loaded[(r)${1}]} ]]
|
||||
then
|
||||
zshlibs_log zconfig "sourcing config '$1'"
|
||||
. -- $1 2>&1 >(zshlibs_log zconfig)
|
||||
zconfig_loaded+=("$1")
|
||||
zshlibs_log zconfig "end sourcing config '$1'"
|
||||
else
|
||||
zshlibs_log zconfig "config '$1' already loaded"
|
||||
zshlibs_log zconfig "currently loaded configs: ${zconfig_loaded}"
|
||||
fi
|
||||
}
|
||||
|
||||
function zconfigs_load()
|
||||
{
|
||||
zshlibs_log zconfig "loading supplied config names"
|
||||
for configfile in ${*}; do
|
||||
zconfig_checkload $configfile
|
||||
done
|
||||
}
|
||||
|
||||
function zconfigs_local_load()
|
||||
{
|
||||
if [[ ! -a ${zconfig_local_path} ]]; then
|
||||
zshlibs_log zconfig "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 zconfig "local config appears to be a file, loading '${zconfig_local_path}'"
|
||||
zconfig_checkload ${zconfig_local_path}
|
||||
else
|
||||
zshlibs_log zconfig "local config is a directory, loading '${zconfig_local_path}/*.config.zsh'"
|
||||
zconfigs_load ${zconfig_local_path}/*.config.zsh;
|
||||
fi
|
||||
}
|
||||
|
||||
# zconfig bootup
|
||||
|
||||
function zconfig_boot()
|
||||
{
|
||||
zconfig_configure
|
||||
zconfig_setup
|
||||
zconfig_setup_interactive
|
||||
}
|
||||
|
||||
function zconfig_configure()
|
||||
{
|
||||
typeset -a -g zconfig_loaded
|
||||
typeset -a -g config_extra # user populatable config names in zshlibs location
|
||||
typeset -g zconfig_shared_path="${zshlibs_install}/config"
|
||||
typeset -g zconfig_local_path="${HOME}/.config/zsh"
|
||||
}
|
||||
|
||||
function zbootstrap_noninteractive()
|
||||
{
|
||||
zshlibs_log zconfig "WARNING: legacy function called"
|
||||
zconfig_configure
|
||||
zconfig_setup
|
||||
}
|
||||
|
||||
function zconfig_setup()
|
||||
{
|
||||
zshlibs_log zconfig 'load global config'
|
||||
zconfig_checkload ${zconfig_shared_path}/global.config.zsh
|
||||
zshlibs_log zconfig 'load local configs'
|
||||
zconfigs_local_load
|
||||
for zconfig in $config_extra; do
|
||||
zshlibs_log zconfig 'load config extra $zconfig'
|
||||
zconfig_checkload ${zconfig_shared_path}/${zconfig}.config.zsh
|
||||
done
|
||||
}
|
||||
|
||||
function zconfig_setup_interactive()
|
||||
{
|
||||
zshlibs_log zconfig "loading interactive config"
|
||||
zconfig_checkload ${zconfig_shared_path}/global.style.zsh
|
||||
zshlibs_log zconfig "done loading interactive config"
|
||||
}
|
4
zconfig.zsh
Normal file
4
zconfig.zsh
Normal file
@ -0,0 +1,4 @@
|
||||
fpath+=(${zshlibs_install}/zconfig)
|
||||
autoload zconfig_boot zconfig_checkload zconfig_configure \
|
||||
zconfig_setup zconfig_setup_interactive zconfigs_load \
|
||||
zconfigs_local_load
|
6
zconfig/zconfig_boot
Normal file
6
zconfig/zconfig_boot
Normal file
@ -0,0 +1,6 @@
|
||||
function zconfig_boot()
|
||||
{
|
||||
zconfig_configure
|
||||
zconfig_setup
|
||||
zconfig_setup_interactive
|
||||
}
|
14
zconfig/zconfig_checkload
Normal file
14
zconfig/zconfig_checkload
Normal file
@ -0,0 +1,14 @@
|
||||
function zconfig_checkload()
|
||||
{
|
||||
typeset -a -g zconfig_loaded
|
||||
if [[ ! ${zconfig_loaded[(r)${1}]} ]]
|
||||
then
|
||||
zshlibs_log zconfig "sourcing config '$1'"
|
||||
. -- $1 2>&1 >(zshlibs_log zconfig)
|
||||
zconfig_loaded+=("$1")
|
||||
zshlibs_log zconfig "end sourcing config '$1'"
|
||||
else
|
||||
zshlibs_log zconfig "config '$1' already loaded"
|
||||
zshlibs_log zconfig "currently loaded configs: ${zconfig_loaded}"
|
||||
fi
|
||||
}
|
7
zconfig/zconfig_configure
Normal file
7
zconfig/zconfig_configure
Normal file
@ -0,0 +1,7 @@
|
||||
function zconfig_configure()
|
||||
{
|
||||
typeset -a -g zconfig_loaded
|
||||
typeset -a -g config_extra # user populatable config names in zshlibs location
|
||||
typeset -g zconfig_shared_path="${zshlibs_install}/config"
|
||||
typeset -g zconfig_local_path="${HOME}/.config/zsh"
|
||||
}
|
11
zconfig/zconfig_setup
Normal file
11
zconfig/zconfig_setup
Normal file
@ -0,0 +1,11 @@
|
||||
function zconfig_setup()
|
||||
{
|
||||
zshlibs_log zconfig 'load global config'
|
||||
zconfig_checkload ${zconfig_shared_path}/global.config.zsh
|
||||
zshlibs_log zconfig 'load local configs'
|
||||
zconfigs_local_load
|
||||
for zconfig in $config_extra; do
|
||||
zshlibs_log zconfig 'load config extra $zconfig'
|
||||
zconfig_checkload ${zconfig_shared_path}/${zconfig}.config.zsh
|
||||
done
|
||||
}
|
6
zconfig/zconfig_setup_interactive
Normal file
6
zconfig/zconfig_setup_interactive
Normal file
@ -0,0 +1,6 @@
|
||||
function zconfig_setup_interactive()
|
||||
{
|
||||
zshlibs_log zconfig "loading interactive config"
|
||||
zconfig_checkload ${zconfig_shared_path}/global.style.zsh
|
||||
zshlibs_log zconfig "done loading interactive config"
|
||||
}
|
7
zconfig/zconfigs_load
Normal file
7
zconfig/zconfigs_load
Normal file
@ -0,0 +1,7 @@
|
||||
function zconfigs_load()
|
||||
{
|
||||
zshlibs_log zconfig "loading supplied config names"
|
||||
for configfile in ${*}; do
|
||||
zconfig_checkload $configfile
|
||||
done
|
||||
}
|
15
zconfig/zconfigs_local_load
Normal file
15
zconfig/zconfigs_local_load
Normal file
@ -0,0 +1,15 @@
|
||||
function zconfigs_local_load()
|
||||
{
|
||||
if [[ ! -a ${zconfig_local_path} ]]; then
|
||||
zshlibs_log zconfig "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 zconfig "local config appears to be a file, loading '${zconfig_local_path}'"
|
||||
zconfig_checkload ${zconfig_local_path}
|
||||
else
|
||||
zshlibs_log zconfig "local config is a directory, loading '${zconfig_local_path}/*.config.zsh'"
|
||||
zconfigs_load ${zconfig_local_path}/*.config.zsh;
|
||||
fi
|
||||
}
|
5
zssh.zsh
5
zssh.zsh
@ -1,3 +1,6 @@
|
||||
fpath+=(${zshlibs_install}/zssh/)
|
||||
autoload zssh_boot
|
||||
autoload zssh_configure zssh_process zssh_check_pubkeys zssh_enumeratenodes \
|
||||
zssh_generate_config4 zssh_generate_hostaccessconfig zssh_generate_privkey4 \
|
||||
zssh_host_info zssh_install_peers zssh_mail_pubkey2 zssh_node_info \
|
||||
zssh_publish_configs zssh_publish_pubkeys zssh_boot
|
||||
|
||||
|
@ -7,10 +7,6 @@ function zssh_boot()
|
||||
typeset -g zssh_private_configs="${zssh_ssh_dotdir}/config.d"
|
||||
typeset -g zssh_global_configs=${globaldots_path}/config/ssh
|
||||
typeset -g zssh_global_pubkeys=${globaldots_path}/keys/ssh
|
||||
autoload zssh_configure zssh_process zssh_check_pubkeys zssh_enumeratenodes \
|
||||
zssh_generate_config4 zssh_generate_hostaccessconfig zssh_generate_privkey4 \
|
||||
zssh_host_info zssh_install_peers zssh_mail_pubkey2 zssh_node_info \
|
||||
zssh_publish_configs zssh_publish_pubkeys
|
||||
zssh_configure
|
||||
zssh_process
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user