Autoload zshlib functions

This commit is contained in:
Rezart Qelibari
2022-01-23 01:15:28 +01:00
parent a80e1ed88f
commit b051463245

View File

@@ -1,6 +1,23 @@
#!/usr/bin/env zsh
function ensureDocopts() {
which docopts > /dev/null
[ $? -eq 0 ] && return
curl --output ./docopts -fsSL https://github.com/astzweig/docopts/releases/download/v.0.7.0/docopts_darwin_amd64
chmod u+x ./docopts
PATH="`pwd`:${PATH}"
}
function autoloadZShLib() {
FPATH="`pwd`/zshlib:${FPATH}"
local funcNames=("${(@f)$(find ./zshlib -type f -perm +u=x | awk -F/ '{ print $NF }')}")
autoload -Uz "${funcNames[@]}"
}
function main() {
ensureDocopts
autoloadZShLib
hio debug "Current working dir is: `pwd`"
}
main