Add autoload-zshlib binary
This commit is contained in:
committed by
T. R. Bernstein
parent
d05cd0d635
commit
1a3b0d9315
15
bin/autoload-zshlib
Executable file
15
bin/autoload-zshlib
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env zsh
|
||||
# vi: set ft=zsh tw=80 ts=2
|
||||
|
||||
function autoloadZshlib() {
|
||||
for fp in $fpath; do
|
||||
if [[ ${fp:t} == 'zshlib.zwc' ]]; then
|
||||
autoload -w $fp
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [[ "${ZSH_EVAL_CONTEXT}" == *file ]]; then
|
||||
autoloadZshlib "$@"
|
||||
fi
|
||||
2
bin/azw
2
bin/azw
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env zsh
|
||||
# vi: set ft=zsh tw=80 ts=2
|
||||
autoload -w zshlib
|
||||
|
||||
function buildExternCommandName() {
|
||||
cmdName="azw-$1"
|
||||
@@ -33,5 +32,6 @@ function dispatchCommand() {
|
||||
|
||||
if [[ "${ZSH_EVAL_CONTEXT}" == toplevel || "${ZSH_EVAL_CONTEXT}" == cmdarg ]]; then
|
||||
_DIR="${0:A:h}"
|
||||
source autoload-zshlib
|
||||
dispatchCommand "$@"
|
||||
fi
|
||||
|
||||
@@ -31,6 +31,6 @@ function main {
|
||||
|
||||
if [[ "${ZSH_EVAL_CONTEXT}" == toplevel || "${ZSH_EVAL_CONTEXT}" == cmdarg ]]; then
|
||||
_DIR="${0:A:h}"
|
||||
autoload -w zshlib
|
||||
source autoload-zshlib
|
||||
main "$@"
|
||||
fi
|
||||
|
||||
@@ -25,6 +25,6 @@ function main() {
|
||||
}
|
||||
|
||||
if [[ "${ZSH_EVAL_CONTEXT}" == toplevel ]]; then
|
||||
autoload -w zshlib
|
||||
source autoload-zshlib
|
||||
main "$@"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user