-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
rc.elv
305 lines (302 loc) · 10.4 KB
/
rc.elv
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
set edit:rprompt = (constantly "")
set edit:prompt = (constantly "% ")
use builtin;
use str;
set edit:completion:arg-completer[exhaustive] = {|@words|
fn spaces {|n|
builtin:repeat $n ' ' | str:join ''
}
fn cand {|text desc|
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
}
var command = 'exhaustive'
for word $words[1..-1] {
if (str:has-prefix $word '-') {
break
}
set command = $command';'$word
}
var completions = [
&'exhaustive'= {
cand --generate 'generate'
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
cand action 'action'
cand quote 'quote'
cand value 'value'
cand pacman 'pacman'
cand last 'last'
cand alias 'alias'
cand hint 'hint'
cand escape-help '\tab "'''
cand complete 'Register shell completions for this program'
cand help 'Print this message or the help of the given subcommand(s)'
}
&'exhaustive;action'= {
cand --set 'value'
cand --choice 'enum'
cand --set-true 'bool'
cand --count 'number'
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;quote'= {
cand --single-quotes 'Can be ''always'', ''auto'', or ''never'''
cand --double-quotes 'Can be "always", "auto", or "never"'
cand --backticks 'For more information see `echo test`'
cand --backslash 'Avoid ''\n'''
cand --brackets 'List packages [filter]'
cand --expansions 'Execute the shell command with $SHELL'
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
cand cmd-single-quotes 'Can be ''always'', ''auto'', or ''never'''
cand cmd-double-quotes 'Can be "always", "auto", or "never"'
cand cmd-backticks 'For more information see `echo test`'
cand cmd-backslash 'Avoid ''\n'''
cand cmd-brackets 'List packages [filter]'
cand cmd-expansions 'Execute the shell command with $SHELL'
cand help 'Print this message or the help of the given subcommand(s)'
}
&'exhaustive;quote;cmd-single-quotes'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;quote;cmd-double-quotes'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;quote;cmd-backticks'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;quote;cmd-backslash'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;quote;cmd-brackets'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;quote;cmd-expansions'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;quote;help'= {
cand cmd-single-quotes 'Can be ''always'', ''auto'', or ''never'''
cand cmd-double-quotes 'Can be "always", "auto", or "never"'
cand cmd-backticks 'For more information see `echo test`'
cand cmd-backslash 'Avoid ''\n'''
cand cmd-brackets 'List packages [filter]'
cand cmd-expansions 'Execute the shell command with $SHELL'
cand help 'Print this message or the help of the given subcommand(s)'
}
&'exhaustive;quote;help;cmd-single-quotes'= {
}
&'exhaustive;quote;help;cmd-double-quotes'= {
}
&'exhaustive;quote;help;cmd-backticks'= {
}
&'exhaustive;quote;help;cmd-backslash'= {
}
&'exhaustive;quote;help;cmd-brackets'= {
}
&'exhaustive;quote;help;cmd-expansions'= {
}
&'exhaustive;quote;help;help'= {
}
&'exhaustive;value'= {
cand --delim 'delim'
cand --tuple 'tuple'
cand --require-eq 'require-eq'
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;pacman'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
cand one 'one'
cand two 'two'
cand help 'Print this message or the help of the given subcommand(s)'
}
&'exhaustive;pacman;one'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;pacman;two'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;pacman;help'= {
cand one 'one'
cand two 'two'
cand help 'Print this message or the help of the given subcommand(s)'
}
&'exhaustive;pacman;help;one'= {
}
&'exhaustive;pacman;help;two'= {
}
&'exhaustive;pacman;help;help'= {
}
&'exhaustive;last'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;alias'= {
cand -o 'cmd option'
cand -O 'cmd option'
cand --option 'cmd option'
cand --opt 'cmd option'
cand -f 'cmd flag'
cand -F 'cmd flag'
cand --flag 'cmd flag'
cand --flg 'cmd flag'
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;hint'= {
cand --choice 'choice'
cand --unknown 'unknown'
cand --other 'other'
cand -p 'p'
cand --path 'path'
cand -f 'f'
cand --file 'file'
cand -d 'd'
cand --dir 'dir'
cand -e 'e'
cand --exe 'exe'
cand --cmd-name 'cmd-name'
cand -c 'c'
cand --cmd 'cmd'
cand -u 'u'
cand --user 'user'
cand -H 'H'
cand --host 'host'
cand --url 'url'
cand --email 'email'
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;escape-help'= {
cand --global 'everywhere'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;complete'= {
cand --shell 'Specify shell to complete for'
cand --register 'Path to write completion-registration to'
cand --global 'everywhere'
cand -h 'Print help (see more with ''--help'')'
cand --help 'Print help (see more with ''--help'')'
cand -V 'Print version'
cand --version 'Print version'
}
&'exhaustive;help'= {
cand action 'action'
cand quote 'quote'
cand value 'value'
cand pacman 'pacman'
cand last 'last'
cand alias 'alias'
cand hint 'hint'
cand escape-help '\tab "'''
cand complete 'Register shell completions for this program'
cand help 'Print this message or the help of the given subcommand(s)'
}
&'exhaustive;help;action'= {
}
&'exhaustive;help;quote'= {
cand cmd-single-quotes 'Can be ''always'', ''auto'', or ''never'''
cand cmd-double-quotes 'Can be "always", "auto", or "never"'
cand cmd-backticks 'For more information see `echo test`'
cand cmd-backslash 'Avoid ''\n'''
cand cmd-brackets 'List packages [filter]'
cand cmd-expansions 'Execute the shell command with $SHELL'
}
&'exhaustive;help;quote;cmd-single-quotes'= {
}
&'exhaustive;help;quote;cmd-double-quotes'= {
}
&'exhaustive;help;quote;cmd-backticks'= {
}
&'exhaustive;help;quote;cmd-backslash'= {
}
&'exhaustive;help;quote;cmd-brackets'= {
}
&'exhaustive;help;quote;cmd-expansions'= {
}
&'exhaustive;help;value'= {
}
&'exhaustive;help;pacman'= {
cand one 'one'
cand two 'two'
}
&'exhaustive;help;pacman;one'= {
}
&'exhaustive;help;pacman;two'= {
}
&'exhaustive;help;last'= {
}
&'exhaustive;help;alias'= {
}
&'exhaustive;help;hint'= {
}
&'exhaustive;help;escape-help'= {
}
&'exhaustive;help;complete'= {
}
&'exhaustive;help;help'= {
}
]
$completions[$command]
}