[zsh] Update shell init: rc
This commit is contained in:
parent
b09d523218
commit
c30b46a88b
26 changed files with 479 additions and 462 deletions
31
zsh/func/load_module
Normal file
31
zsh/func/load_module
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env zsh
|
||||
# Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
function load_module
|
||||
{
|
||||
local mod=$1
|
||||
|
||||
local modpath
|
||||
for p in $fpath; do
|
||||
modpath=$p/$mod
|
||||
[[ -d $modpath ]] && break
|
||||
modpath=''
|
||||
done
|
||||
|
||||
if [[ -z "$modpath" ]]; then
|
||||
shell-log -l error "Couldn't find path to module: $mod"
|
||||
return 1
|
||||
fi
|
||||
|
||||
fpath+=($modpath)
|
||||
|
||||
shell-log "Loading module: $mod"
|
||||
for func in `ls $modpath`; do
|
||||
shell-log "Loading function: $func"
|
||||
autoload $func
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
load_module "$@"
|
Loading…
Add table
Add a link
Reference in a new issue