mirror of
https://github.com/tonarino/innernet.git
synced 2024-11-10 17:04:53 +08:00
193 lines
9.9 KiB
Text
193 lines
9.9 KiB
Text
|
|
use builtin;
|
|
use str;
|
|
|
|
set edit:completion:arg-completer[innernet] = {|@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 = 'innernet'
|
|
for word $words[1..-1] {
|
|
if (str:has-prefix $word '-') {
|
|
break
|
|
}
|
|
set command = $command';'$word
|
|
}
|
|
var completions = [
|
|
&'innernet'= {
|
|
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'
|
|
cand --mtu 'Specify the desired MTU for your interface (default: 1420 for IPv4 and 1400 for IPv6)'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
cand -V 'Print version information'
|
|
cand --version 'Print version information'
|
|
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'
|
|
cand down 'Bring down the interface (equivalent to ''wg-quick down <interface>'')'
|
|
cand add-peer 'Add a new peer'
|
|
cand rename-peer 'Rename a peer'
|
|
cand add-cidr 'Add a new CIDR'
|
|
cand delete-cidr 'Delete a CIDR'
|
|
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'
|
|
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'
|
|
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'
|
|
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'''
|
|
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'
|
|
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'
|
|
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'
|
|
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'''
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;fetch'= {
|
|
cand --hosts-path 'The path to write hosts to'
|
|
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 --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'''
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;uninstall'= {
|
|
cand --yes 'Bypass confirmation'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;down'= {
|
|
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'
|
|
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'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;rename-peer'= {
|
|
cand --name 'Name of peer to rename'
|
|
cand --new-name 'The new name of the peer'
|
|
cand --yes 'Bypass confirmation'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;add-cidr'= {
|
|
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'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;delete-cidr'= {
|
|
cand --name 'The CIDR name (eg. ''engineers'')'
|
|
cand --yes 'Bypass confirmation'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;list-cidrs'= {
|
|
cand -t 'Display CIDRs in tree format'
|
|
cand --tree 'Display CIDRs in tree format'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;disable-peer'= {
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;enable-peer'= {
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;add-association'= {
|
|
cand --yes 'Bypass confirmation'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;delete-association'= {
|
|
cand --yes 'Bypass confirmation'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;list-associations'= {
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;set-listen-port'= {
|
|
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'
|
|
cand --yes 'Bypass confirmation'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;override-endpoint'= {
|
|
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'
|
|
cand --yes 'Bypass confirmation'
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;completions'= {
|
|
cand -h 'Print help information'
|
|
cand --help 'Print help information'
|
|
}
|
|
&'innernet;help'= {
|
|
}
|
|
]
|
|
$completions[$command]
|
|
}
|