148 lines
6.1 KiB
Plaintext
148 lines
6.1 KiB
Plaintext
|
|
use builtin;
|
|
use str;
|
|
|
|
set edit:completion:arg-completer[innernet-server] = {|@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-server'
|
|
for word $words[1..-1] {
|
|
if (str:has-prefix $word '-') {
|
|
break
|
|
}
|
|
set command = $command';'$word
|
|
}
|
|
var completions = [
|
|
&'innernet-server'= {
|
|
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: 1280)'
|
|
cand --no-routing 'Whether the routing should be done by innernet or is done by an external tool like e.g. babeld'
|
|
cand -h 'Print help'
|
|
cand --help 'Print help'
|
|
cand -V 'Print version'
|
|
cand --version 'Print version'
|
|
cand new 'Create a new network'
|
|
cand uninstall 'Permanently uninstall a created network, rendering it unusable. Use with care'
|
|
cand serve 'Serve the coordinating server for an existing network'
|
|
cand add-peer 'Add a peer to an existing network'
|
|
cand disable-peer 'Disable an enabled peer'
|
|
cand enable-peer 'Enable a disabled peer'
|
|
cand rename-peer 'Rename an existing peer'
|
|
cand add-cidr 'Add a new CIDR to an existing network'
|
|
cand delete-cidr 'Delete a CIDR'
|
|
cand completions 'Generate shell completion scripts'
|
|
cand help 'Print this message or the help of the given subcommand(s)'
|
|
}
|
|
&'innernet-server;new'= {
|
|
cand --network-name 'The network name (ex: evilcorp)'
|
|
cand --network-cidr 'The network CIDR (ex: 10.42.0.0/16)'
|
|
cand --external-endpoint 'This server''s external endpoint (ex: 100.100.100.100:51820)'
|
|
cand --listen-port 'Port to listen on (for the WireGuard interface)'
|
|
cand --auto-external-endpoint 'Auto-resolve external endpoint'
|
|
cand -h 'Print help'
|
|
cand --help 'Print help'
|
|
}
|
|
&'innernet-server;uninstall'= {
|
|
cand --yes 'Bypass confirmation'
|
|
cand -h 'Print help'
|
|
cand --help 'Print help'
|
|
}
|
|
&'innernet-server;serve'= {
|
|
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: 1280)'
|
|
cand --no-routing 'Whether the routing should be done by innernet or is done by an external tool like e.g. babeld'
|
|
cand -h 'Print help'
|
|
cand --help 'Print help'
|
|
}
|
|
&'innernet-server;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'
|
|
cand --help 'Print help'
|
|
}
|
|
&'innernet-server;disable-peer'= {
|
|
cand -h 'Print help'
|
|
cand --help 'Print help'
|
|
}
|
|
&'innernet-server;enable-peer'= {
|
|
cand -h 'Print help'
|
|
cand --help 'Print help'
|
|
}
|
|
&'innernet-server;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'
|
|
cand --help 'Print help'
|
|
}
|
|
&'innernet-server;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'
|
|
cand --help 'Print help'
|
|
}
|
|
&'innernet-server;delete-cidr'= {
|
|
cand --name 'The CIDR name (eg. ''engineers'')'
|
|
cand --yes 'Bypass confirmation'
|
|
cand -h 'Print help'
|
|
cand --help 'Print help'
|
|
}
|
|
&'innernet-server;completions'= {
|
|
cand -h 'Print help'
|
|
cand --help 'Print help'
|
|
}
|
|
&'innernet-server;help'= {
|
|
cand new 'Create a new network'
|
|
cand uninstall 'Permanently uninstall a created network, rendering it unusable. Use with care'
|
|
cand serve 'Serve the coordinating server for an existing network'
|
|
cand add-peer 'Add a peer to an existing network'
|
|
cand disable-peer 'Disable an enabled peer'
|
|
cand enable-peer 'Enable a disabled peer'
|
|
cand rename-peer 'Rename an existing peer'
|
|
cand add-cidr 'Add a new CIDR to an existing network'
|
|
cand delete-cidr 'Delete a CIDR'
|
|
cand completions 'Generate shell completion scripts'
|
|
cand help 'Print this message or the help of the given subcommand(s)'
|
|
}
|
|
&'innernet-server;help;new'= {
|
|
}
|
|
&'innernet-server;help;uninstall'= {
|
|
}
|
|
&'innernet-server;help;serve'= {
|
|
}
|
|
&'innernet-server;help;add-peer'= {
|
|
}
|
|
&'innernet-server;help;disable-peer'= {
|
|
}
|
|
&'innernet-server;help;enable-peer'= {
|
|
}
|
|
&'innernet-server;help;rename-peer'= {
|
|
}
|
|
&'innernet-server;help;add-cidr'= {
|
|
}
|
|
&'innernet-server;help;delete-cidr'= {
|
|
}
|
|
&'innernet-server;help;completions'= {
|
|
}
|
|
&'innernet-server;help;help'= {
|
|
}
|
|
]
|
|
$completions[$command]
|
|
}
|