-
Notifications
You must be signed in to change notification settings - Fork 188
/
innernet.completions.zsh
513 lines (483 loc) · 16 KB
/
innernet.completions.zsh
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
#compdef innernet
autoload -U is-at-least
_innernet() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'--backend=[Specify a WireGuard backend to use. If not set, innernet will auto-select based on availability]: :(kernel userspace)' \
'--mtu=[Specify the desired MTU for your interface (default: 1420 for IPv4 and 1400 for IPv6)]' \
'*-v[Verbose output, use -vv for even higher verbositude]' \
'*--verbose[Verbose output, use -vv for even higher verbositude]' \
'--no-routing[Whether the routing should be done by innernet or is done by an external tool like e.g. babeld]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_innernet_commands" \
"*::: :->innernet" \
&& ret=0
case $state in
(innernet)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:innernet-command-$line[1]:"
case $line[1] in
(redeem)
_arguments "${_arguments_options[@]}" \
'--hosts-path=[The path to write hosts to]' \
'(--default-name)--name=[Set a specific interface name]' \
'(--hosts-path)--no-write-hosts[Don'\''t write to any hosts files]' \
'--default-name[Use the network name inside the invitation as the interface name]' \
'-d[Delete the invitation after a successful install]' \
'--delete-invite[Delete the invitation after a successful install]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':invite -- Path to the invitation file:_files' \
&& ret=0
;;
(redeem)
_arguments "${_arguments_options[@]}" \
'--hosts-path=[The path to write hosts to]' \
'(--default-name)--name=[Set a specific interface name]' \
'(--hosts-path)--no-write-hosts[Don'\''t write to any hosts files]' \
'--default-name[Use the network name inside the invitation as the interface name]' \
'-d[Delete the invitation after a successful install]' \
'--delete-invite[Delete the invitation after a successful install]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':invite -- Path to the invitation file:_files' \
&& ret=0
;;
(install)
_arguments "${_arguments_options[@]}" \
'--hosts-path=[The path to write hosts to]' \
'(--default-name)--name=[Set a specific interface name]' \
'(--hosts-path)--no-write-hosts[Don'\''t write to any hosts files]' \
'--default-name[Use the network name inside the invitation as the interface name]' \
'-d[Delete the invitation after a successful install]' \
'--delete-invite[Delete the invitation after a successful install]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':invite -- Path to the invitation file:_files' \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" \
'-s[One-line peer list]' \
'--short[One-line peer list]' \
'-t[Display peers in a tree based on the CIDRs]' \
'--tree[Display peers in a tree based on the CIDRs]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::interface:_files' \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" \
'-s[One-line peer list]' \
'--short[One-line peer list]' \
'-t[Display peers in a tree based on the CIDRs]' \
'--tree[Display peers in a tree based on the CIDRs]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::interface:_files' \
&& ret=0
;;
(show)
_arguments "${_arguments_options[@]}" \
'-s[One-line peer list]' \
'--short[One-line peer list]' \
'-t[Display peers in a tree based on the CIDRs]' \
'--tree[Display peers in a tree based on the CIDRs]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::interface:_files' \
&& ret=0
;;
(up)
_arguments "${_arguments_options[@]}" \
'--interval=[Keep fetching the latest peer list at the specified interval in seconds. Valid only in daemon mode]' \
'--hosts-path=[The path to write hosts to]' \
'-d[Enable daemon mode i.e. keep the process running, while fetching the latest peer list periodically]' \
'--daemon[Enable daemon mode i.e. keep the process running, while fetching the latest peer list periodically]' \
'(--hosts-path)--no-write-hosts[Don'\''t write to any hosts files]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(fetch)
_arguments "${_arguments_options[@]}" \
'--hosts-path=[The path to write hosts to]' \
'(--hosts-path)--no-write-hosts[Don'\''t write to any hosts files]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(uninstall)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(down)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(add-peer)
_arguments "${_arguments_options[@]}" \
'--name=[Name of new peer]' \
'(--auto-ip)--ip=[Specify desired IP of new peer (within parent CIDR)]' \
'--cidr=[Name of CIDR to add new peer under]' \
'--admin=[Make new peer an admin?]' \
'--save-config=[Save the config to the given location]' \
'--invite-expires=[Invite expiration period (eg. "30d", "7w", "2h", "60m", "1000s")]' \
'--auto-ip[Auto-assign the peer the first available IP within the CIDR]' \
'--yes[Bypass confirmation]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(rename-peer)
_arguments "${_arguments_options[@]}" \
'--name=[Name of peer to rename]' \
'--new-name=[The new name of the peer]' \
'--yes[Bypass confirmation]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(add-cidr)
_arguments "${_arguments_options[@]}" \
'--name=[The CIDR name (eg. "engineers")]' \
'--cidr=[The CIDR network (eg. "10.42.5.0/24")]' \
'--parent=[The CIDR parent name]' \
'--yes[Bypass confirmation]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(delete-cidr)
_arguments "${_arguments_options[@]}" \
'--name=[The CIDR name (eg. "engineers")]' \
'--yes[Bypass confirmation]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(list-cidrs)
_arguments "${_arguments_options[@]}" \
'-t[Display CIDRs in tree format]' \
'--tree[Display CIDRs in tree format]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(disable-peer)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(enable-peer)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(add-association)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
'::cidr1 -- The first cidr to associate:_files' \
'::cidr2 -- The second cidr to associate:_files' \
&& ret=0
;;
(delete-association)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(list-associations)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(set-listen-port)
_arguments "${_arguments_options[@]}" \
'-u[Unset the local listen port to use a randomized port]' \
'--unset[Unset the local listen port to use a randomized port]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(override-endpoint)
_arguments "${_arguments_options[@]}" \
'-u[Unset an existing override to use the automatic endpoint discovery]' \
'--unset[Unset an existing override to use the automatic endpoint discovery]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':interface:_files' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':shell:(zsh bash fish powershell elvish)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_innernet_commands] )) ||
_innernet_commands() {
local commands; commands=(
"install:Install a new innernet config" \
"show:Enumerate all innernet connections" \
"up:Bring up your local interface, and update it with latest peer list" \
"fetch:Fetch and update your local interface with the latest peer list" \
"uninstall:Uninstall an innernet network" \
"down:Bring down the interface (equivalent to "wg-quick down <interface>")" \
"add-peer:Add a new peer" \
"rename-peer:Rename a peer" \
"add-cidr:Add a new CIDR" \
"delete-cidr:Delete a CIDR" \
"list-cidrs:List CIDRs" \
"disable-peer:Disable an enabled peer" \
"enable-peer:Enable a disabled peer" \
"add-association:Add an association between CIDRs" \
"delete-association:Delete an association between CIDRs" \
"list-associations:List existing assocations between CIDRs" \
"set-listen-port:Set the local listen port" \
"override-endpoint:Override your external endpoint that the server sends to other peers" \
"completions:Generate shell completion scripts" \
"help:Prints this message or the help of the given subcommand(s)" \
)
_describe -t commands 'innernet commands' commands "$@"
}
(( $+functions[_innernet__add-association_commands] )) ||
_innernet__add-association_commands() {
local commands; commands=(
)
_describe -t commands 'innernet add-association commands' commands "$@"
}
(( $+functions[_innernet__add-cidr_commands] )) ||
_innernet__add-cidr_commands() {
local commands; commands=(
)
_describe -t commands 'innernet add-cidr commands' commands "$@"
}
(( $+functions[_innernet__add-peer_commands] )) ||
_innernet__add-peer_commands() {
local commands; commands=(
)
_describe -t commands 'innernet add-peer commands' commands "$@"
}
(( $+functions[_innernet__completions_commands] )) ||
_innernet__completions_commands() {
local commands; commands=(
)
_describe -t commands 'innernet completions commands' commands "$@"
}
(( $+functions[_innernet__delete-association_commands] )) ||
_innernet__delete-association_commands() {
local commands; commands=(
)
_describe -t commands 'innernet delete-association commands' commands "$@"
}
(( $+functions[_innernet__delete-cidr_commands] )) ||
_innernet__delete-cidr_commands() {
local commands; commands=(
)
_describe -t commands 'innernet delete-cidr commands' commands "$@"
}
(( $+functions[_innernet__disable-peer_commands] )) ||
_innernet__disable-peer_commands() {
local commands; commands=(
)
_describe -t commands 'innernet disable-peer commands' commands "$@"
}
(( $+functions[_innernet__down_commands] )) ||
_innernet__down_commands() {
local commands; commands=(
)
_describe -t commands 'innernet down commands' commands "$@"
}
(( $+functions[_innernet__enable-peer_commands] )) ||
_innernet__enable-peer_commands() {
local commands; commands=(
)
_describe -t commands 'innernet enable-peer commands' commands "$@"
}
(( $+functions[_innernet__fetch_commands] )) ||
_innernet__fetch_commands() {
local commands; commands=(
)
_describe -t commands 'innernet fetch commands' commands "$@"
}
(( $+functions[_innernet__help_commands] )) ||
_innernet__help_commands() {
local commands; commands=(
)
_describe -t commands 'innernet help commands' commands "$@"
}
(( $+functions[_innernet__install_commands] )) ||
_innernet__install_commands() {
local commands; commands=(
)
_describe -t commands 'innernet install commands' commands "$@"
}
(( $+functions[_innernet__list_commands] )) ||
_innernet__list_commands() {
local commands; commands=(
)
_describe -t commands 'innernet list commands' commands "$@"
}
(( $+functions[_list_commands] )) ||
_list_commands() {
local commands; commands=(
)
_describe -t commands 'list commands' commands "$@"
}
(( $+functions[_innernet__list-associations_commands] )) ||
_innernet__list-associations_commands() {
local commands; commands=(
)
_describe -t commands 'innernet list-associations commands' commands "$@"
}
(( $+functions[_innernet__list-cidrs_commands] )) ||
_innernet__list-cidrs_commands() {
local commands; commands=(
)
_describe -t commands 'innernet list-cidrs commands' commands "$@"
}
(( $+functions[_innernet__override-endpoint_commands] )) ||
_innernet__override-endpoint_commands() {
local commands; commands=(
)
_describe -t commands 'innernet override-endpoint commands' commands "$@"
}
(( $+functions[_innernet__redeem_commands] )) ||
_innernet__redeem_commands() {
local commands; commands=(
)
_describe -t commands 'innernet redeem commands' commands "$@"
}
(( $+functions[_redeem_commands] )) ||
_redeem_commands() {
local commands; commands=(
)
_describe -t commands 'redeem commands' commands "$@"
}
(( $+functions[_innernet__rename-peer_commands] )) ||
_innernet__rename-peer_commands() {
local commands; commands=(
)
_describe -t commands 'innernet rename-peer commands' commands "$@"
}
(( $+functions[_innernet__set-listen-port_commands] )) ||
_innernet__set-listen-port_commands() {
local commands; commands=(
)
_describe -t commands 'innernet set-listen-port commands' commands "$@"
}
(( $+functions[_innernet__show_commands] )) ||
_innernet__show_commands() {
local commands; commands=(
)
_describe -t commands 'innernet show commands' commands "$@"
}
(( $+functions[_innernet__uninstall_commands] )) ||
_innernet__uninstall_commands() {
local commands; commands=(
)
_describe -t commands 'innernet uninstall commands' commands "$@"
}
(( $+functions[_innernet__up_commands] )) ||
_innernet__up_commands() {
local commands; commands=(
)
_describe -t commands 'innernet up commands' commands "$@"
}
_innernet "$@"