-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_ztupide
29 lines (26 loc) · 802 Bytes
/
_ztupide
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#compdef ztupide
local line
_arguments -C \
'1: :((load:"load plugin" unload:"remove plugin" update:"update ztupide and all plugins" help:"print help message"))' \
'*::arg:->args'
local plugins=("${ZTUPIDE_PLUGIN_PATH}"/*(/N))
for ((i = 1; i <= ${#plugins}; i++)); do
if [ -d "${plugins[${i}]}"/.git ]; then
plugins[${i}]="${plugins[${i}]:t}:'Remote plugin'"
else
plugins[${i}]="${plugins[${i}]:t}:'Local plugin'"
fi
done
case ${line[1]} in
load)
_arguments -C "1: :((--async:'load plugin asynchronously' ${plugins[*]}))" '*::arg:->args'
case ${line[1]} in
--async)
_arguments "1: :((${plugins[*]}))"
;;
esac
;;
unload)
_arguments "1: :((${plugins[*]}))"
;;
esac