-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathndk-pkg-zsh-completion
320 lines (309 loc) · 18.3 KB
/
ndk-pkg-zsh-completion
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
#compdef ndk-pkg
_ndk_pkg_actions=(
'-h:show help of this command.'
'--help:show help of this command.'
'-V:show version of this.'
'--version:show version of this command.'
'about:show basic information about this software.'
'sysinfo:show basic information about your current running operation system.'
'ndkinfo:show basic information about the given Android NDK.'
'setup:install essential tools used by this shell script.'
'integrate:integrate zsh completions and cmake support.'
'ls-available:list the available packages.'
'ls-installed:list the installed packages.'
'ls-outdated:list the installed packages which can be upgraded.'
'is-available:is the given package available.'
'is-installed:is the given package installed.'
'is-outdated:is the given package outdated.'
'search:search all available packages whose name matches the given regular expression pattern.'
'info-available:show information of the given available package.'
'info-installed:show information of the given installed package.'
'formula-repo-add:create a new empty formula repository.'
'formula-repo-del:delete the given formula repository from your local cache.'
'formula-repo-sync:sync the given formula repository.'
'formula-repo-conf:change the config of the given formula repository.'
'formula-repo-info:show information of the given formula repository.'
'formula-repo-list:list all available formula repositories.'
'install:install packages.'
'reinstall:reinstall packages.'
'uninstall:uninstall packages.'
'cleanup:delete the unused cached files'
'update:update all available formula repositories.'
'upgrade:upgrade the outdated packages'
'upgrade-self:upgrade this software.'
'fetch:download formula resources of the given package to the cache.'
'depends:show the depends of the given package.'
'tree:list files of the given installed package in a tree-like format.'
'logs:show logs of the given installed package.'
'pack:pack the given installed package.'
'export:export the given installed package as the google prefab aar.'
'deploy:export the given installed package as the google prefab aar then deploy it to Maven Local Repository or Sonatype OSSRH.'
'gen-url-transform-sample:generate url-transform sample.'
'android-versions:show android platform version, android API level, android version code map.'
)
function _ndk_pkg_available_packages() {
local -a _available_packages
_available_packages=($(ndk-pkg ls-available 2>/dev/null))
_describe 'available-packages' _available_packages
}
function _ndk_pkg_installed_packages() {
local -a _installed_packages
_installed_packages=($(ndk-pkg ls-installed 2>/dev/null | sed 's|:|\\:|g'))
_describe 'installed-packages' _installed_packages
}
function _ndk_pkg_installed_package_names() {
local -a _installed_packages
_installed_packages=($(ndk-pkg ls-installed 2>/dev/null | cut -d: -f1))
_describe 'installed-packages' _installed_packages
}
function _ndk_pkg_outdated_packages() {
local -a _outdated_packages
_outdated_packages=($(ndk-pkg ls-outdated 2>/dev/null | sed 's|:|\\:|g'))
_describe 'outdated-packages' _outdated_packages
}
function _ndk_pkg_outdated_package_names() {
local -a _outdated_packages
_outdated_packages=($(ndk-pkg ls-outdated 2>/dev/null | cut -d: -f1))
_describe 'outdated-packages' _outdated_packages
}
function _ndk_pkg() {
local context state state_descr line
typeset -A opt_args
_arguments \
'1: :{_describe ndk_pkg_actions _ndk_pkg_actions}' \
'*:: :->option'
case $state in
option)
case $words[1] in
formula-repo-add)
_arguments \
'1:formula-repo-name:(name)' \
'2:formula-repo-url:(https://)' \
'--branch=-[specify the formula repo branch]' \
'--sync[sync with the server after the formula repo is created]' \
+ '(pin)' \
'--pin[set pinned to 1]' \
'--unpin[set pinned to 0]' \
+ '(enable)' \
'--enable[set enabled to 1]' \
'--disable[set enabled to 0]'
;;
formula-repo-conf)
_arguments \
'1:formula-repo-name:($(ndk-pkg formula-repo-list | sed -n "/^name: /p" | cut -c7-))' \
'--url=-[change the formula repo url]' \
'--branch=-[change the formula repo branch]' \
+ '(pin)' \
'--pin[set pinned to 1]' \
'--unpin[set pinned to 0]' \
+ '(enable)' \
'--enable[set enabled to 1]' \
'--disable[set enabled to 0]'
;;
formula-repo-del)
_arguments '1:formula-repo-name:($(ndk-pkg formula-repo-list | sed -n "/^name: /p" | cut -c7-))'
;;
formula-repo-sync)
_arguments '1:formula-repo-name:($(ndk-pkg formula-repo-list | sed -n "/^name: /p" | cut -c7-))'
;;
formula-repo-info)
_arguments '1:formula-repo-name:($(ndk-pkg formula-repo-list | sed -n "/^name: /p" | cut -c7-))'
;;
info-available)
_arguments \
'1:package-name:_ndk_pkg_available_packages' \
'2:key:(--yaml --json pkgtype summary version license web-url git-url git-sha git-ref git-nth src-url src-sha src-ft src-fp fix-url fix-sha fix-ft fix-fp res-url res-sha res-ft res-fp dep-pkg dep-upp dep-pym dep-plm ppflags ccflags xxflags ldflags bscript binbstd bsystem onstart onready onfinal do12345 dopatch prepare install dotweak caveats parallel developer api-min)'
;;
info-installed)
_arguments \
'1:package-name:_ndk_pkg_installed_packages' \
'2:key:(--yaml --json pkgtype summary version license web-url git-url git-sha git-ref git-nth src-url src-sha src-ft src-fp fix-url fix-sha fix-ft fix-fp res-url res-sha res-ft res-fp dep-pkg dep-upp dep-pym dep-plm ppflags ccflags xxflags ldflags bscript binbstd bsystem onstart onready onfinal do12345 dopatch prepare install dotweak caveats parallel developer api-min --prefix --files builtat builtat-rfc-3339 builtat-iso-8601 builtat-rfc-3339-utc builtat-iso-8601-utc)'
;;
fetch)
_arguments ':package-name:_ndk_pkg_available_packages'
;;
depends)
_arguments \
'1:package-name:_ndk_pkg_available_packages' \
'-t[specify output format]:output-type:(d2 dot box svg png)' \
'-o[specify output filepath or directory]:output-path:_files'
;;
pack)
_arguments \
'1:package-name:_ndk_pkg_installed_packages' \
'-t[specify output type]:output-type:(zip 7z tar.gz tar.xz tar.lz tar.bz2)' \
'-o[specify output filepath or directory]:output-path:_files' \
'-K[do not delete the session directory even if successfully packed]'
;;
export)
_arguments \
'1:package-name:_ndk_pkg_installed_package_names' \
'--ndk-home=-[specify Android NDK HOME directory]:ndk-home:_path_files -/' \
'-o[specify output filepath or directory]:output-path:_files' \
'-K[do not delete the session directory even if successfully exported]'
;;
deploy)
_arguments \
'1:package-name:_ndk_pkg_installed_package_names' \
'-K[do not delete the session directory even if successfully deployed]' \
'--dry-run[do not actually deploy the aar]' \
'--debug[debug the process of deployment]' \
'--groupId=-[specify groupId]:groupId:(com. org.)' \
+ '(where_to_deploy)' \
'--remote[deploy to Sonatype OSSRH]' \
'--local=-[specify the local repository path]:local-path:_path_files -/'
;;
tree)
_arguments \
'1:package-name:_ndk_pkg_installed_packages' \
'-L[level]:level:(3)' \
'--dirsfirst[show directories first]'
;;
logs)
_arguments '1:package-name:_ndk_pkg_installed_packages'
;;
install)
_arguments \
':package-name:_ndk_pkg_available_packages' \
'--ndk-home=-[specify Android NDK HOME directory]:ndk-home:_path_files -/' \
'--target=-[specify the target to be built for]:target:(android-21-armeabi-v7a android-21-arm64-v8a android-21-x86 android-21-x86_64)' \
'--profile=-[specify build profile]:profile:(debug release)' \
'--static[create fully statically linked executables]' \
'-j[specify the number of jobs you can run in parallel]:jobs:(1 2 3 4 5 6 7 8 9)' \
'-I[specify the formula search directory]:search-dir:_path_files -/' \
'-U[upgrade if possible]' \
'-K[keep the session directory even if successfully installed]' \
'-E[export compile_commands.json]' \
'--disable-ccache[do not use ccache]' \
'-v-env[show all environment variables before starting to build]' \
'-v-http[show http request/response]' \
'-v-ndk[show Android NDK information]' \
'-v-formula[show formula content]' \
'-v-go[pass -v argument to go build command]' \
'-v-uppm[pass -v argument to uppm command]' \
'-v-cargo[pass -v argument to cargo command]' \
'-v-meson[pass -v argument to meson command]' \
'-v-ninja[pass -v argument to ninja command]' \
'-v-gmake[pass V=1 argument to gmake command]' \
'-v-xmake[pass -v argument to xmake command]' \
'-v-cmake[pass -DCMAKE_VERBOSE_MAKEFILE argument to cmake command]' \
'-x-sh[set -x to debug current running shell]' \
'-x-cc[pass -v argument to clang command]' \
'-x-ld[pass -Wl,-v argument to linker]' \
'-x-go[pass -x argument to go build command]' \
'-x-cargo[pass -vv argument to cargo command]' \
'-x-gmake[pass --debug argument to gmake command]' \
'-x-cmake[pass -DCMAKE_FIND_DEBUG_MODE=ON argument to cmake command]' \
'-x-xmake[pass -vD argument to xmake command]' \
'-x-pkg-config[export PKG_CONFIG_DEBUG_SPEW=1]' \
+ '(verbose_level)' \
'-x[very verbose mode. equivalent to -v-* and -x-* options all are supplied]' \
'-v[verbose mode. equivalent to -v-* options all are supplied]' \
'-q[silent mode.]'
;;
reinstall)
_arguments \
':package-name:_ndk_pkg_installed_packages' \
'--ndk-home=-[specify Android NDK HOME directory]:ndk-home:_path_files -/' \
'--target=-[specify the target to be built for]:target:(android-21-armeabi-v7a android-21-arm64-v8a android-21-x86 android-21-x86_64)' \
'--profile=-[specify build profile]:profile:(debug release)' \
'--static[create fully statically linked executables]' \
'-j[specify the number of jobs you can run in parallel]:jobs:(1 2 3 4 5 6 7 8 9)' \
'-I[specify the formula search directory]:search-dir:_path_files -/' \
'-U[upgrade if possible]' \
'-K[keep the session directory even if successfully installed]' \
'-E[export compile_commands.json]' \
'--disable-ccache[do not use ccache]' \
'-v-env[show all environment variables before starting to build]' \
'-v-http[show http request/response]' \
'-v-ndk[show Android NDK information]' \
'-v-formula[show formula content]' \
'-v-go[pass -v argument to go build command]' \
'-v-uppm[pass -v argument to uppm command]' \
'-v-ninja[pass -v argument to ninja command]' \
'-v-meson[pass -v argument to meson command]' \
'-v-cargo[pass -v argument to cargo command]' \
'-v-gmake[pass V=1 argument to gmake command]' \
'-v-xmake[pass -v argument to xmake command]' \
'-v-cmake[pass -DCMAKE_VERBOSE_MAKEFILE argument to cmake command]' \
'-x-sh[set -x to debug current running shell]' \
'-x-go[pass -x argument to go build command]' \
'-x-cc[pass -v argument to clang command]' \
'-x-ld[pass -Wl,-v argument to linker]' \
'-x-cargo[pass -vv argument to cargo command]' \
'-x-gmake[pass --debug argument to gmake command]' \
'-x-cmake[pass -DCMAKE_FIND_DEBUG_MODE=ON argument to cmake command]' \
'-x-xmake[pass -vD argument to xmake command]' \
'-x-pkg-config[export PKG_CONFIG_DEBUG_SPEW=1]' \
+ '(verbose_level)' \
'-x[very verbose mode. equivalent to -v-* and -x-* options all are supplied]' \
'-v[verbose mode. equivalent to -v-* options all are supplied]' \
'-q[silent mode.]'
;;
upgrade)
_arguments \
':package-name:_ndk_pkg_outdated_packages' \
'--ndk-home=-[specify Android NDK HOME directory]:ndk-home:_path_files -/' \
'--target=-[specify the target to be built for]:target:(android-21-armeabi-v7a android-21-arm64-v8a android-21-x86 android-21-x86_64)' \
'--profile=-[specify build profile]:profile:(debug release)' \
'--static[create fully statically linked executables]' \
'-j[specify the number of jobs you can run in parallel]:jobs:(1 2 3 4 5 6 7 8 9)' \
'-I[specify the formula search directory]:search-dir:_path_files -/' \
'-U[upgrade if possible]' \
'-K[keep the session directory even if successfully installed]' \
'-E[export compile_commands.json]' \
'--disable-ccache[do not use ccache]' \
'-v-env[show all environment variables before starting to build]' \
'-v-http[show http request/response]' \
'-v-ndk[show Android NDK information]' \
'-v-formula[show formula content]' \
'-v-go[pass -v argument to go build command]' \
'-v-uppm[pass -v argument to uppm command]' \
'-v-ninja[pass -v argument to ninja command]' \
'-v-meson[pass -v argument to meson command]' \
'-v-cargo[pass -v argument to cargo command]' \
'-v-gmake[pass V=1 argument to gmake command]' \
'-v-xmake[pass -v argument to xmake command]' \
'-v-cmake[pass -DCMAKE_VERBOSE_MAKEFILE argument to cmake command]' \
'-x-sh[set -x to debug current running shell]' \
'-x-cc[pass -v argument to clang command]' \
'-x-ld[pass -Wl,-v argument to linker]' \
'-x-go[pass -x argument to go build command]' \
'-x-cargo[pass -vv argument to cargo command]' \
'-x-gmake[pass --debug argument to gmake command]' \
'-x-cmake[pass -DCMAKE_FIND_DEBUG_MODE=ON argument to cmake command]' \
'-x-xmake[pass -vD argument to xmake command]' \
'-x-pkg-config[export PKG_CONFIG_DEBUG_SPEW=1]' \
+ '(verbose_level)' \
'-x[very verbose mode. equivalent to -v-* and -x-* options all are supplied]' \
'-v[verbose mode. equivalent to -v-* options all are supplied]' \
'-q[silent mode.]'
;;
uninstall)
_arguments '*:package-name:_ndk_pkg_installed_packages'
;;
is-available)
_arguments '1:package-name:_ndk_pkg_available_packages'
;;
is-installed)
_arguments '1:package-name:_ndk_pkg_installed_packages'
;;
is-outdated)
_arguments '1:package-name:_ndk_pkg_outdated_packages'
;;
ls-installed)
_arguments ':package-name:_ndk_pkg_installed_package_names'
;;
integrate)
_arguments '1:what:(zsh cmake)'
;;
ndkinfo)
_arguments '1:ndk-home:_path_files -/'
;;
*) ;;
esac
;;
*);;
esac
}
_ndk_pkg "$@"