innernet/doc/innernet.completions.elvish

194 lines
9.8 KiB
Plaintext
Raw Normal View History

2022-01-11 20:18:19 +00:00
use builtin;
use str;
2022-01-12 22:31:31 +00:00
set edit:completion:arg-completer[innernet] = {|@words|
fn spaces {|n|
2022-01-11 20:18:19 +00:00
builtin:repeat $n ' ' | str:join ''
}
2022-01-12 22:31:31 +00:00
fn cand {|text desc|
2022-01-11 20:18:19 +00:00
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
}
2022-01-11 20:18:19 +00:00
var command = 'innernet'
for word $words[1..-1] {
if (str:has-prefix $word '-') {
break
}
2022-01-11 20:18:19 +00:00
set command = $command';'$word
}
2022-01-11 20:18:19 +00:00
var completions = [
&'innernet'= {
2021-12-05 17:35:18 +00:00
cand -c 'c'
cand --config-dir 'config-dir'
cand -d 'd'
cand --data-dir 'data-dir'
cand --backend 'Specify a WireGuard backend to use. If not set, innernet will auto-select based on availability'
2022-03-15 02:15:56 +00:00
cand --mtu 'Specify the desired MTU for your interface (default: 1280)'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
2021-05-31 15:23:14 +00:00
cand -v 'Verbose output, use -vv for even higher verbositude'
cand --verbose 'Verbose output, use -vv for even higher verbositude'
cand --no-routing 'Whether the routing should be done by innernet or is done by an external tool like e.g. babeld'
cand install 'Install a new innernet config'
cand show 'Enumerate all innernet connections'
cand up 'Bring up your local interface, and update it with latest peer list'
cand fetch 'Fetch and update your local interface with the latest peer list'
cand uninstall 'Uninstall an innernet network'
2021-11-11 09:42:21 +00:00
cand down 'Bring down the interface (equivalent to ''wg-quick down <interface>'')'
cand add-peer 'Add a new peer'
2021-05-31 15:23:14 +00:00
cand rename-peer 'Rename a peer'
cand add-cidr 'Add a new CIDR'
cand delete-cidr 'Delete a CIDR'
2021-06-14 14:53:02 +00:00
cand list-cidrs 'List CIDRs'
cand disable-peer 'Disable an enabled peer'
cand enable-peer 'Enable a disabled peer'
cand add-association 'Add an association between CIDRs'
cand delete-association 'Delete an association between CIDRs'
cand list-associations 'List existing assocations between CIDRs'
cand set-listen-port 'Set the local listen port'
cand override-endpoint 'Override your external endpoint that the server sends to other peers'
cand completions 'Generate shell completion scripts'
2022-01-11 20:18:19 +00:00
cand help 'Print this message or the help of the given subcommand(s)'
}
&'innernet;install'= {
cand --hosts-path 'The path to write hosts to'
cand --name 'Set a specific interface name'
2021-12-05 17:35:18 +00:00
cand --exclude-nat-candidates 'Exclude one or more CIDRs from NAT candidate reporting. ex. --exclude-nat-candidates ''0.0.0.0/0'' would report no candidates'
cand --no-write-hosts 'Don''t write to any hosts files'
cand --default-name 'Use the network name inside the invitation as the interface name'
cand -d 'Delete the invitation after a successful install'
cand --delete-invite 'Delete the invitation after a successful install'
2021-12-05 17:35:18 +00:00
cand --no-nat-traversal 'Don''t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates'
cand --no-nat-candidates 'Don''t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates ''0.0.0.0/0'''
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;show'= {
cand -s 'One-line peer list'
cand --short 'One-line peer list'
cand -t 'Display peers in a tree based on the CIDRs'
cand --tree 'Display peers in a tree based on the CIDRs'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;up'= {
cand --interval 'Keep fetching the latest peer list at the specified interval in seconds. Valid only in daemon mode'
cand --hosts-path 'The path to write hosts to'
2021-12-05 17:35:18 +00:00
cand --exclude-nat-candidates 'Exclude one or more CIDRs from NAT candidate reporting. ex. --exclude-nat-candidates ''0.0.0.0/0'' would report no candidates'
cand -d 'Enable daemon mode i.e. keep the process running, while fetching the latest peer list periodically'
cand --daemon 'Enable daemon mode i.e. keep the process running, while fetching the latest peer list periodically'
cand --no-write-hosts 'Don''t write to any hosts files'
2021-12-05 17:35:18 +00:00
cand --no-nat-traversal 'Don''t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates'
cand --no-nat-candidates 'Don''t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates ''0.0.0.0/0'''
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;fetch'= {
cand --hosts-path 'The path to write hosts to'
2021-12-05 17:35:18 +00:00
cand --exclude-nat-candidates 'Exclude one or more CIDRs from NAT candidate reporting. ex. --exclude-nat-candidates ''0.0.0.0/0'' would report no candidates'
cand --no-write-hosts 'Don''t write to any hosts files'
2021-12-05 17:35:18 +00:00
cand --no-nat-traversal 'Don''t attempt NAT traversal. Note that this still will report candidates unless you also specify to exclude all NAT candidates'
cand --no-nat-candidates 'Don''t report any candidates to coordinating server. Shorthand for --exclude-nat-candidates ''0.0.0.0/0'''
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;uninstall'= {
2022-01-31 19:56:11 +00:00
cand --yes 'Bypass confirmation'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;down'= {
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;add-peer'= {
cand --name 'Name of new peer'
cand --ip 'Specify desired IP of new peer (within parent CIDR)'
cand --cidr 'Name of CIDR to add new peer under'
cand --admin 'Make new peer an admin?'
cand --save-config 'Save the config to the given location'
2021-11-11 09:42:21 +00:00
cand --invite-expires 'Invite expiration period (eg. ''30d'', ''7w'', ''2h'', ''60m'', ''1000s'')'
cand --auto-ip 'Auto-assign the peer the first available IP within the CIDR'
cand --yes 'Bypass confirmation'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
2021-05-31 15:23:14 +00:00
&'innernet;rename-peer'= {
cand --name 'Name of peer to rename'
cand --new-name 'The new name of the peer'
cand --yes 'Bypass confirmation'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
2021-05-31 15:23:14 +00:00
}
&'innernet;add-cidr'= {
2021-11-11 09:42:21 +00:00
cand --name 'The CIDR name (eg. ''engineers'')'
cand --cidr 'The CIDR network (eg. ''10.42.5.0/24'')'
cand --parent 'The CIDR parent name'
cand --yes 'Bypass confirmation'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;delete-cidr'= {
2021-11-11 09:42:21 +00:00
cand --name 'The CIDR name (eg. ''engineers'')'
cand --yes 'Bypass confirmation'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
2021-06-14 14:53:02 +00:00
&'innernet;list-cidrs'= {
cand -t 'Display CIDRs in tree format'
cand --tree 'Display CIDRs in tree format'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
2021-06-14 14:53:02 +00:00
}
&'innernet;disable-peer'= {
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;enable-peer'= {
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;add-association'= {
2022-01-31 19:56:11 +00:00
cand --yes 'Bypass confirmation'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;delete-association'= {
2022-01-31 19:56:11 +00:00
cand --yes 'Bypass confirmation'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;list-associations'= {
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;set-listen-port'= {
2021-12-05 17:35:18 +00:00
cand -l 'The listen port you''d like to set for the interface'
cand --listen-port 'The listen port you''d like to set for the interface'
cand -u 'Unset the local listen port to use a randomized port'
cand --unset 'Unset the local listen port to use a randomized port'
2021-12-05 17:35:18 +00:00
cand --yes 'Bypass confirmation'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;override-endpoint'= {
2021-12-05 17:35:18 +00:00
cand -e 'The listen port you''d like to set for the interface'
cand --endpoint 'The listen port you''d like to set for the interface'
cand -u 'Unset an existing override to use the automatic endpoint discovery'
cand --unset 'Unset an existing override to use the automatic endpoint discovery'
2021-12-05 17:35:18 +00:00
cand --yes 'Bypass confirmation'
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;completions'= {
2022-01-11 20:18:19 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
}
&'innernet;help'= {
}
]
$completions[$command]
}