From b05146324510e859805a4920a0418046f959b384 Mon Sep 17 00:00:00 2001 From: Rezart Qelibari Date: Sun, 23 Jan 2022 01:15:28 +0100 Subject: [PATCH] Autoload zshlib functions --- install.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/install.sh b/install.sh index 879cff4..81268f5 100755 --- a/install.sh +++ b/install.sh @@ -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