forked from es-meta/esmeta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.completion
95 lines (94 loc) · 3.23 KB
/
.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
# `complete` for zsh
if type complete &>/dev/null; then
:
else
autoload bashcompinit
bashcompinit
fi
# completion for esmeta
_esmeta_completions() {
local cur prev opts lastc informats outformats datafiles
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmdList="help extract compile build-cfg tycheck parse eval web test262-test inject mutate analyze"
globalOpt="-silent -error -status -time -test262dir"
helpOpt=""
extractOpt="-extract:target -extract:log -extract:eval -extract:repl"
compileOpt="-compile:log -compile:log-with-loc"
buildcfgOpt="-build-cfg:log -build-cfg:dot -build-cfg:pdf"
tycheckOpt="-tycheck:target -tycheck:repl -tycheck:repl-continue -tycheck:ignore -tycheck:update-ignore -tycheck:log"
parseOpt="-parse:debug"
evalOpt="-eval:timeout -eval:tycheck -eval:multiple -eval:log"
webOpt="-web:port"
test262testOpt="-test262-test:target -test262-test:progress -test262-test:coverage -test262-test:timeout -test262-test:with-yet -test262-test:log"
injectOpt="-inject:defs -inject:out -inject:log"
mutateOpt="-mutate:out -mutate:mutator -mutate:untilValid"
analyzeOpt="-analyze:repl"
# completion for commands
case "${COMP_CWORD}" in
1)
COMPREPLY=($(compgen -W "version -version --version ${cmdList}"))
return 0
;;
esac
cmd="${COMP_WORDS[1]}"
# completion for options
case "${cur}" in
-*)
case "${cmd}" in
help)
COMPREPLY=($(compgen -W "${globalOpt} ${helpOpt}"))
return 0
;;
extract)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt}"))
return 0
;;
compile)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt}"))
return 0
;;
build-cfg)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt}"))
return 0
;;
tycheck)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${tycheckOpt}"))
return 0
;;
parse)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${parseOpt}"))
return 0
;;
eval)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${evalOpt}"))
return 0
;;
web)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${webOpt}"))
return 0
;;
test262-test)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${test262testOpt}"))
return 0
;;
inject)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${injectOpt}"))
return 0
;;
mutate)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${mutateOpt}"))
return 0
;;
analyze)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${analyzeOpt}"))
return 0
;;
esac
return 0
;;
esac
COMPREPLY=( $(compgen -X '' -f "${cur}") )
}
# completion setting
complete -o filenames -o bashdefault -F _esmeta_completions esmeta