-
Notifications
You must be signed in to change notification settings - Fork 1
/
_haxelib
130 lines (105 loc) · 2.9 KB
/
_haxelib
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#compdef haxelib
#autoload
zmodload zsh/regex
_haxelib() {
if (( CURRENT > 2 )); then
# Remember the subcommand name
local cmd=${words[2]}
# Set the context for the subcommand.
curcontext="${curcontext%:*:*}:haxelib-$cmd"
# Narrow the range of words we are looking at to exclude `haxelib´
(( CURRENT-- ))
shift words
case "$cmd" in
upgrade|selfupdate|register)
return 1;;
esac
# Run the completion for the subcommand
_haxelib_cmd_$cmd
else
local hline
local -a cmdlist
_call_program help-commands haxelib | while read -A hline; do
(( ${#hline} < 4 )) && continue
[[ $hline[1] = (#i)Haxe ]] && continue
[[ $hline[1] = (#i)Usage ]] && continue
[[ $hline[1] = (#i)commands ]] && continue
cmdlist=($cmdlist "${hline[1]}:${hline[3,-1]}")
done
_describe -t haxelib-commands "Haxelib command" cmdlist
fi
}
_haxelib_local_libs() {
eval $'installed_libs=( ${(s.\n.)"$(haxelib list | cut -d ":" -f 1)"} )'
}
_haxelib_remote_libs() {
eval $'remote_libs=( ${(s.\n.)"%(zshcomplete remote)"} )'
}
local -a installed_libs
local -a remote_libs
_haxelib_cmd_install() {
_haxelib_remote_libs
_path_files -/ -g "*.hxml"
_wanted remote-libs expl '' compadd -x "Insufficient completion for haxelib-install, only hxml so far!" -a remote_libs
}
_haxelib_cmd_list() {
compadd -x "No completion so far for haxelib list"
}
_haxelib_cmd_update() {
_haxelib_local_libs
_wanted installed-libs expl '' compadd -x "Matching haxe libraries" -a installed_libs
}
_haxelib_cmd_remove() {
_haxelib_local_libs
_wanted installed_libs expl '' compadd -x "Matching haxe libraries" -a installed_libs
}
_haxelib_cmd_set() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_search() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_info() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_user() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_submit() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_setup() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_convertxml() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_config() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_path() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_run() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_local() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_dev() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_git() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib_cmd_proxy() {
compadd -x "$cmd-completion not implemented!"
}
_haxelib "$@"
# _lib_remote() {
# local cache_file=/tmp/haxelib_remote~
# if [[ ! -f $cache_file(mh-1) ]]; then
# zshcomplete remote > "$cache_file"
# fi
# eval $'remote_libs=( ${(s.\n.)"$(cat $cache_file)"} )'
# }