-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy path_zig.bash
519 lines (476 loc) · 20.3 KB
/
_zig.bash
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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# This file is generated by [bash-completor](https://github.com/adoyle-h/bash-completor/tree/v0.1.0). Do not modify it manually.
#
# [Usage]
# Put "source _zig.bash" in your bashrc.
#
# If you want to debug the completion.
# Search '# Uncomment this line for debug' line in this file.
#
# [Update Script]
# bash-completor -c ./zig.completor.bash
#
# [Maintainers]
# ADoyle ([email protected])
#
# [Notice]
# Current no completions for zig commands: cc c++ lib
# shellcheck disable=2207
# editorconfig-checker-disable
_zig_comp_cmd_opts=( -h --help )
_zig_comp_subcmd_opts__fallback=( --help )
_zig_comp_subcmd_opts_ar=( --format --plugin= -h --help --output --rsp-quoting --thin --version -X32 -X64 -X32_64 -X @ )
_zig_comp_subcmd_opts_ast_check=( -h --help --color -t )
_zig_comp_subcmd_opts_build=( -p --prefix --prefix-lib-dir --prefix-exe-dir --prefix-include-dir --release= -fdarling -fno-darling -fqemu -fno-qemu --glibc-runtimes -frosetta -fno-rosetta -fwasmtime -fno-wasmtime -fwine -fno-wine -h --help -l, --list-steps --verbose --color --prominent-compile-errors --summary --j --maxrss --fetch -Dtarget= -Dcpu= -Ddynamic-linker= -Doptimize= --search-prefix --sysroot --libc --system -fsys= -fno-sys= -freference-trace -fno-reference-trace --build-file --cache-dir --global-cache-dir --zig-lib-dir --build-runner --seed --debug-log --debug-pkg-config --verbose-link --verbose-air --verbose-llvm-ir --verbose-llvm-bc= --verbose-cimport --verbose-cc --verbose-llvm-cpu-features )
_zig_comp_subcmd_opts_build_fallback=( @files )
_zig_comp_subcmd_opts_dlltool=( -D -d -f -k -l -m -S )
_zig_comp_subcmd_opts_fmt=( -h --help --color --stdin --check --ast-check --exclude )
_zig_comp_subcmd_opts_libc=( -h --help -target -includes )
_zig_comp_subcmd_opts_ranlib=( -h --help -v --version -D -U )
_zig_comp_subcmd_opts_run=( -- -h --help --watch --color -femit-bin -fno-emit-bin -femit-asm -fno-emit-asm -femit-llvm-ir -fno-emit-llvm-ir -femit-llvm-bc -fno-emit-llvm-bc -femit-h -fno-emit-h -femit-docs -fno-emit-docs -femit-analysis -fno-emit-analysis -femit-implib -fno-emit-implib --show-builtin --cache-dir --global-cache-dir --zig-lib-dir --enable-cache -target -mcpu -mcmodel= -mred-zone -mno-red-zone -fomit-frame-pointer -fno-omit-frame-pointer -mexec-model= --name -O --pkg-begin --pkg-end --main-pkg-path -fPIC -fno-PIC -fPIE -fno-PIE -flto -fno-lto -fstack-check -fno-stack-check -fstack-protector -fno-stack-protector -fsanitize-c -fno-sanitize-c -fvalgrind -fno-valgrind -fsanitize-thread -fno-sanitize-thread -fdll-export-fns -fno-dll-export-fns -funwind-tables -fno-unwind-tables -fLLVM -fno-LLVM -fClang -fno-Clang -fstage1 -fno-stage1 -freference-trace -fno-reference-trace -fsingle-threaded -fno-single-threaded -fbuiltin -fno-builtin -ffunction-sections -fno-function-sections -fstrip -fno-strip -ofmt= -idirafter -isystem -I -D --libc -cflags -l --library -needed-l --needed-library -L --library-directory -T --script --version-script --dynamic-linker --sysroot --version --entry -fsoname -fno-soname -fLLD -fno-LLD -fcompiler-rt -fno-compiler-rt -rdynamic -rpath -feach-lib-rpath -fno-each-lib-rpath -fallow-shlib-undefined -fno-allow-shlib-undefined -fbuild-id -fno-build-id --eh-frame-hdr --emit-relocs -z -dynamic -static -Bsymbolic --compress-debug-sections= --gc-sections --no-gc-sections --subsystem --stack --image-base -weak-l -weak_library -framework -needed_framework -needed_library -weak_framework -F -install_name= --entitlements -pagezero_size -search_paths_first -search_dylibs_first -headerpad -headerpad_max_install_names -dead_strip -dead_strip_dylibs --import-memory --import-table --export-table --initial-memory= --max-memory= --shared-memory --global-base= --export= -ftime-report -fstack-report --verbose-link --verbose-cc --verbose-air --verbose-llvm-ir --verbose-cimport --verbose-llvm-cpu-features --debug-log --debug-compile-errors --debug-link-snapshot )
_zig_comp_subcmd_opts_test=( --test-filter --test-name-prefix --test-cmd --test-cmd-bin --test-evented-io --test-no-exec -h --help --watch --color -femit-bin -fno-emit-bin -femit-asm -fno-emit-asm -femit-llvm-ir -fno-emit-llvm-ir -femit-llvm-bc -fno-emit-llvm-bc -femit-h -fno-emit-h -femit-docs -fno-emit-docs -femit-analysis -fno-emit-analysis -femit-implib -fno-emit-implib --show-builtin --cache-dir --global-cache-dir --zig-lib-dir --enable-cache -target -mcpu -mcmodel= -mred-zone -mno-red-zone -fomit-frame-pointer -fno-omit-frame-pointer -mexec-model= --name -O --pkg-begin --pkg-end --main-pkg-path -fPIC -fno-PIC -fPIE -fno-PIE -flto -fno-lto -fstack-check -fno-stack-check -fstack-protector -fno-stack-protector -fsanitize-c -fno-sanitize-c -fvalgrind -fno-valgrind -fsanitize-thread -fno-sanitize-thread -fdll-export-fns -fno-dll-export-fns -funwind-tables -fno-unwind-tables -fLLVM -fno-LLVM -fClang -fno-Clang -fstage1 -fno-stage1 -freference-trace -fno-reference-trace -fsingle-threaded -fno-single-threaded -fbuiltin -fno-builtin -ffunction-sections -fno-function-sections -fstrip -fno-strip -ofmt= -idirafter -isystem -I -D --libc -cflags -l --library -needed-l --needed-library -L --library-directory -T --script --version-script --dynamic-linker --sysroot --version --entry -fsoname -fno-soname -fLLD -fno-LLD -fcompiler-rt -fno-compiler-rt -rdynamic -rpath -feach-lib-rpath -fno-each-lib-rpath -fallow-shlib-undefined -fno-allow-shlib-undefined -fbuild-id -fno-build-id --eh-frame-hdr --emit-relocs -z -dynamic -static -Bsymbolic --compress-debug-sections= --gc-sections --no-gc-sections --subsystem --stack --image-base -weak-l -weak_library -framework -needed_framework -needed_library -weak_framework -F -install_name= --entitlements -pagezero_size -search_paths_first -search_dylibs_first -headerpad -headerpad_max_install_names -dead_strip -dead_strip_dylibs --import-memory --import-table --export-table --initial-memory= --max-memory= --shared-memory --global-base= --export= -ftime-report -fstack-report --verbose-link --verbose-cc --verbose-air --verbose-llvm-ir --verbose-cimport --verbose-llvm-cpu-features --debug-log --debug-compile-errors --debug-link-snapshot )
declare -A _zig_comp_word_to_varname=([c++]="cpp" )
_zig_comp_util_get_varname ()
{
local name=${1:-};
local encoded=${_zig_comp_word_to_varname[$name]:-};
if [[ -z ${encoded} ]]; then
encoded=${name//[^a-zA-Z_]/_};
fi;
echo "${encoded}"
}
_zig_comp_reply_dirs ()
{
local IFS=$'\n';
compopt -o nospace -o filenames;
COMPREPLY=($(compgen -A directory -- "$cur"))
}
_zig_comp_reply_files ()
{
local IFS=$'\n';
compopt -o nospace -o filenames;
COMPREPLY=($(compgen -A file -- "$cur"))
}
_zig_comp_reply_files_in_pattern ()
{
compopt -o nospace -o filenames;
local path;
while read -r path; do
if [[ $path =~ $1 ]] || [[ -d $path ]]; then
COMPREPLY+=("$path");
fi;
done < <(compgen -A file -- "$cur")
}
_zig_comp_reply_list ()
{
local IFS=', ';
local array_list="" array_name;
for array_name in $@;
do
array_list="$array_list \${${array_name}[*]}";
done;
array_list="${array_list[*]:1}";
IFS=$'\n'' ';
eval "COMPREPLY=( \$(compgen -W \"$array_list\" -- \"\$cur\") )"
}
_zig_comp_reply_words ()
{
local IFS=$'\n';
COMPREPLY=($(IFS=', ' compgen -W "$*" -- "${cur#=}"))
}
_zig_comp_reply_set() {
local IFS=', '
local array_list="" array_name
# shellcheck disable=2068
for array_name in $@; do
array_list="$array_list \${_zig_comp_var_${array_name}[*]}"
done
array_list="${array_list[*]:1}"
IFS=$'\n'' '
eval "COMPREPLY=( \$(compgen -W \"$array_list\" -- \"\$cur\") )"
}
_zig_comp_reply_zig_file() {
_zig_comp_reply_files_in_pattern '\.(zig|zir|zon|o|obj|lib|a|so|dll|dylib|tbd|s|S|c|cxx|cc|C|cpp|stub|m|mm|bc|cu)$'
}
_zig_comp_subcmds=( build fetch init build-exe build-lib build-obj test run ast-check fmt reduce translate-c ar cc c++ dlltool lib ranlib rc env help std libc targets version zen )
_zig_comp_equal_sign_subcmd_opts_build() {
case "${1}=" in
--release=) _zig_comp_reply_words 'fast,safe,small' ;;
-Dtarget=) ;;
-Dcpu=) ;;
-Ddynamic-linker=) ;;
-Doptimize=) _zig_comp_reply_words 'Debug,ReleaseSafe,ReleaseFast,ReleaseSmall' ;;
-fsys=) ;;
-fno-sys=) ;;
--verbose-llvm-bc=) ;;
esac
}
_zig_completions_build() {
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_subcmd_opts_build
if [[ ${COMPREPLY[*]} =~ =$ ]]; then compopt -o nospace; fi
elif [[ ${cur} == = ]]; then
_zig_comp_equal_sign_subcmd_opts_build "$prev"
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
-p) _zig_comp_reply_dirs ;;
--prefix) _zig_comp_reply_dirs ;;
--prefix-lib-dir) _zig_comp_reply_dirs ;;
--prefix-exe-dir) _zig_comp_reply_dirs ;;
--prefix-include-dir) _zig_comp_reply_dirs ;;
--color) _zig_comp_reply_words 'auto,off,on' ;;
--summary) _zig_comp_reply_words 'all,new,failures,none' ;;
--maxrss) ;;
--search-prefix) _zig_comp_reply_dirs ;;
--sysroot) _zig_comp_reply_dirs ;;
--system) _zig_comp_reply_dirs ;;
-freference-trace) ;;
--cache-dir) _zig_comp_reply_dirs ;;
--global-cache-dir) _zig_comp_reply_dirs ;;
--zig-lib-dir) _zig_comp_reply_dirs ;;
--seed) ;;
--debug-log) ;;
*) _zig_comp_reply_files ;;
esac
elif [[ ${prev} == = ]]; then
_zig_comp_equal_sign_subcmd_opts_build "${COMP_WORDS[$(( COMP_CWORD - 2 ))]}"
else
# rely the argument of command
_zig_comp_reply_words 'install,uninstall,run,test'
fi
}
_zig_comp_equal_sign_subcmd_opts_test() {
case "${1}=" in
-mcmodel=) _zig_comp_reply_words 'default,tiny,small,kernel,medium,large' ;;
-mexec-model=) ;;
-ofmt=) _zig_comp_reply_words 'elf,c,wasm,coff,macho,spirv,plan9,hex,raw' ;;
--compress-debug-sections=) _zig_comp_reply_words 'none,zlib' ;;
-install_name=) ;;
--initial-memory=) ;;
--max-memory=) ;;
--global-base=) ;;
--export=) ;;
esac
}
_zig_completions_test() {
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_subcmd_opts_test
if [[ ${COMPREPLY[*]} =~ =$ ]]; then compopt -o nospace; fi
elif [[ ${cur} == = ]]; then
_zig_comp_equal_sign_subcmd_opts_test "$prev"
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
--test-filter) ;;
--test-name-prefix) ;;
--test-cmd) ;;
--color) _zig_comp_reply_words 'auto,off,on' ;;
-femit-bin) _zig_comp_reply_files ;;
-femit-asm) _zig_comp_reply_files ;;
-femit-llvm-ir) _zig_comp_reply_files ;;
-femit-llvm-bc) _zig_comp_reply_files ;;
-femit-h) _zig_comp_reply_files ;;
-femit-docs) _zig_comp_reply_dirs ;;
-femit-analysis) _zig_comp_reply_files ;;
-femit-implib) _zig_comp_reply_files ;;
--cache-dir) _zig_comp_reply_dirs ;;
--global-cache-dir) _zig_comp_reply_dirs ;;
--zig-lib-dir) _zig_comp_reply_dirs ;;
-target) ;;
-mcpu) ;;
-fomit-frame-pointer) ;;
--name) ;;
-O) _zig_comp_reply_words 'Debug,ReleaseFast,ReleaseSafe,ReleaseSmall' ;;
--pkg-begin) ;;
--main-pkg-path) _zig_comp_reply_dirs ;;
-idirafter) _zig_comp_reply_dirs ;;
-isystem) _zig_comp_reply_dirs ;;
-I) _zig_comp_reply_dirs ;;
-cflags) ;;
-l) _zig_comp_reply_files ;;
--library) _zig_comp_reply_files ;;
-needed-l) _zig_comp_reply_files ;;
--needed-library) _zig_comp_reply_files ;;
-L) _zig_comp_reply_dirs ;;
--library-directory) _zig_comp_reply_dirs ;;
-T) _zig_comp_reply_files ;;
--script) _zig_comp_reply_files ;;
--version-script) _zig_comp_reply_files ;;
--dynamic-linker) _zig_comp_reply_files ;;
--sysroot) _zig_comp_reply_dirs ;;
--version) ;;
--entry) ;;
-fsoname) ;;
-rpath) _zig_comp_reply_dirs ;;
-z) _zig_comp_reply_words 'nodelete,notext,defs,origin,nocopyreloc,now,lazy,relro,norelro' ;;
--subsystem) ;;
--stack) ;;
--image-base) ;;
-weak-l) _zig_comp_reply_files ;;
-weak_library) _zig_comp_reply_files ;;
-framework) ;;
-needed_framework) ;;
-needed_library) _zig_comp_reply_files ;;
-weak_framework) ;;
-F) _zig_comp_reply_dirs ;;
--entitlements) _zig_comp_reply_files ;;
-pagezero_size) ;;
-headerpad) ;;
--debug-log) ;;
*) _zig_comp_reply_zig_file ;;
esac
elif [[ ${prev} == = ]]; then
_zig_comp_equal_sign_subcmd_opts_test "${COMP_WORDS[$(( COMP_CWORD - 2 ))]}"
else
# rely the argument of command
_zig_comp_reply_zig_file
fi
}
_zig_comp_equal_sign_subcmd_opts_run() {
case "${1}=" in
-mcmodel=) _zig_comp_reply_words 'default,tiny,small,kernel,medium,large' ;;
-mexec-model=) ;;
-ofmt=) _zig_comp_reply_words 'elf,c,wasm,coff,macho,spirv,plan9,hex,raw' ;;
--compress-debug-sections=) _zig_comp_reply_words 'none,zlib' ;;
-install_name=) ;;
--initial-memory=) ;;
--max-memory=) ;;
--global-base=) ;;
--export=) ;;
esac
}
_zig_completions_run() {
if [[ $COMP_LINE == *' -- '* ]]; then
# When current command line contains the "--" option, other options are forbidden.
_zig_comp_reply_zig_file
elif [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_subcmd_opts_run
if [[ ${COMPREPLY[*]} =~ =$ ]]; then compopt -o nospace; fi
elif [[ ${cur} == = ]]; then
_zig_comp_equal_sign_subcmd_opts_run "$prev"
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
--color) _zig_comp_reply_words 'auto,off,on' ;;
-femit-bin) _zig_comp_reply_files ;;
-femit-asm) _zig_comp_reply_files ;;
-femit-llvm-ir) _zig_comp_reply_files ;;
-femit-llvm-bc) _zig_comp_reply_files ;;
-femit-h) _zig_comp_reply_files ;;
-femit-docs) _zig_comp_reply_dirs ;;
-femit-analysis) _zig_comp_reply_files ;;
-femit-implib) _zig_comp_reply_files ;;
--cache-dir) _zig_comp_reply_dirs ;;
--global-cache-dir) _zig_comp_reply_dirs ;;
--zig-lib-dir) _zig_comp_reply_dirs ;;
-target) ;;
-mcpu) ;;
-fomit-frame-pointer) ;;
--name) ;;
-O) _zig_comp_reply_words 'Debug,ReleaseFast,ReleaseSafe,ReleaseSmall' ;;
--pkg-begin) ;;
--main-pkg-path) _zig_comp_reply_dirs ;;
-idirafter) _zig_comp_reply_dirs ;;
-isystem) _zig_comp_reply_dirs ;;
-I) _zig_comp_reply_dirs ;;
-cflags) ;;
-l) _zig_comp_reply_files ;;
--library) _zig_comp_reply_files ;;
-needed-l) _zig_comp_reply_files ;;
--needed-library) _zig_comp_reply_files ;;
-L) _zig_comp_reply_dirs ;;
--library-directory) _zig_comp_reply_dirs ;;
-T) _zig_comp_reply_files ;;
--script) _zig_comp_reply_files ;;
--version-script) _zig_comp_reply_files ;;
--dynamic-linker) _zig_comp_reply_files ;;
--sysroot) _zig_comp_reply_dirs ;;
--version) ;;
--entry) ;;
-fsoname) ;;
-rpath) _zig_comp_reply_dirs ;;
-z) _zig_comp_reply_words 'nodelete,notext,defs,origin,nocopyreloc,now,lazy,relro,norelro' ;;
--subsystem) ;;
--stack) ;;
--image-base) ;;
-weak-l) _zig_comp_reply_files ;;
-weak_library) _zig_comp_reply_files ;;
-framework) ;;
-needed_framework) ;;
-needed_library) _zig_comp_reply_files ;;
-weak_framework) ;;
-F) _zig_comp_reply_dirs ;;
--entitlements) _zig_comp_reply_files ;;
-pagezero_size) ;;
-headerpad) ;;
--debug-log) ;;
*) _zig_comp_reply_zig_file ;;
esac
elif [[ ${prev} == = ]]; then
_zig_comp_equal_sign_subcmd_opts_run "${COMP_WORDS[$(( COMP_CWORD - 2 ))]}"
else
# rely the argument of command
_zig_comp_reply_zig_file
fi
}
_zig_completions_ast_check() {
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_subcmd_opts_ast_check
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
--color) _zig_comp_reply_words 'auto,off,on' ;;
*) _zig_comp_reply_zig_file ;;
esac
else
# rely the argument of command
_zig_comp_reply_zig_file
fi
}
_zig_completions_fmt() {
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_subcmd_opts_fmt
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
--color) _zig_comp_reply_words 'auto,off,on' ;;
*) _zig_comp_reply_zig_file ;;
esac
else
# rely the argument of command
_zig_comp_reply_zig_file
fi
}
_zig_comp_equal_sign_subcmd_opts_ar() {
case "${1}=" in
--plugin=) ;;
esac
}
_zig_completions_ar() {
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_subcmd_opts_ar
if [[ ${COMPREPLY[*]} =~ =$ ]]; then compopt -o nospace; fi
elif [[ ${cur} == = ]]; then
_zig_comp_equal_sign_subcmd_opts_ar "$prev"
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
--format) _zig_comp_reply_words 'default,gnu,darwin,bsd,bigarchive' ;;
--rsp-quoting) _zig_comp_reply_words 'posix,windows' ;;
-X) ;;
@) _zig_comp_reply_files ;;
*) _zig_comp_reply_zig_file ;;
esac
elif [[ ${prev} == = ]]; then
_zig_comp_equal_sign_subcmd_opts_ar "${COMP_WORDS[$(( COMP_CWORD - 2 ))]}"
else
# rely the argument of command
_zig_comp_reply_zig_file
fi
}
_zig_completions_dlltool() {
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_subcmd_opts_dlltool
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
-D) ;;
-f) ;;
-l) ;;
-m) ;;
-S) ;;
*) _zig_comp_reply_files ;;
esac
else
# rely the argument of command
_zig_comp_reply_files
fi
}
_zig_completions_ranlib() {
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_subcmd_opts_ranlib
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
*) _zig_comp_reply_files ;;
esac
else
# rely the argument of command
_zig_comp_reply_files
fi
}
_zig_completions_libc() {
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_subcmd_opts_libc
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
-target) ;;
*) _zig_comp_reply_zig_file ;;
esac
else
# rely the argument of command
_zig_comp_reply_zig_file
fi
}
_zig_completions_build_lib() { _zig_completions_run; }
_zig_completions_build_translate_c() { _zig_completions_run; }
_zig_completions_build_exe() { _zig_completions_run; }
_zig_completions_build_obj() { _zig_completions_run; }
_zig_completions__fallback() {
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_subcmd_opts__fallback
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
*) _zig_comp_reply_files ;;
esac
else
# rely the argument of command
_zig_comp_reply_files
fi
}
_zig_completions() {
COMPREPLY=()
local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[COMP_CWORD-1]}
# Uncomment this line for debug
# echo "[COMP_CWORD:$COMP_CWORD][cur:$cur][prev:$prev][WORD_COUNT:${#COMP_WORDS[*]}][COMP_WORDS:${COMP_WORDS[*]}]" >> bash-debug.log
if (( COMP_CWORD > 1 )); then
# Enter the subcmd completion
local subcmd_varname
subcmd_varname="$(_zig_comp_util_get_varname "${COMP_WORDS[1]}")"
if type "_zig_completions_$subcmd_varname" &>/dev/null; then
"_zig_completions_$subcmd_varname"
else
# If subcmd completion function not defined, use the fallback
"_zig_completions__fallback"
fi
return 0
fi
# Enter the cmd completion
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_zig_comp_reply_list _zig_comp_cmd_opts
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
*) _zig_comp_reply_files ;;
esac
else
# rely the argument of command
_zig_comp_reply_list _zig_comp_subcmds
fi
}
complete -F _zig_completions -o bashdefault zig
# vi: sw=2 ts=2