2021-05-25 07:10:16 +00:00
|
|
|
|
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-server] = {|@words|
|
|
|
|
fn spaces {|n|
|
2022-01-11 20:18:19 +00:00
|
|
|
builtin:repeat $n ' ' | str:join ''
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
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
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
2022-01-11 20:18:19 +00:00
|
|
|
var command = 'innernet-server'
|
|
|
|
for word $words[1..-1] {
|
|
|
|
if (str:has-prefix $word '-') {
|
2021-05-25 07:10:16 +00:00
|
|
|
break
|
|
|
|
}
|
2022-01-11 20:18:19 +00:00
|
|
|
set command = $command';'$word
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
2022-01-11 20:18:19 +00:00
|
|
|
var completions = [
|
2021-05-25 07:10:16 +00:00
|
|
|
&'innernet-server'= {
|
2021-12-05 17:35:18 +00:00
|
|
|
cand -c 'c'
|
|
|
|
cand --config-dir 'config-dir'
|
|
|
|
cand -d 'd'
|
|
|
|
cand --data-dir 'data-dir'
|
2021-05-25 07:10:16 +00:00
|
|
|
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)'
|
2021-05-25 07:10:16 +00:00
|
|
|
cand --no-routing 'Whether the routing should be done by innernet or is done by an external tool like e.g. babeld'
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
|
|
|
cand -V 'Print version'
|
|
|
|
cand --version 'Print version'
|
2021-05-25 07:10:16 +00:00
|
|
|
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'
|
2022-09-24 04:16:35 +00:00
|
|
|
cand disable-peer 'Disable an enabled peer'
|
|
|
|
cand enable-peer 'Enable a disabled peer'
|
2021-05-31 15:23:14 +00:00
|
|
|
cand rename-peer 'Rename an existing peer'
|
2021-05-25 07:10:16 +00:00
|
|
|
cand add-cidr 'Add a new CIDR to an existing network'
|
|
|
|
cand delete-cidr 'Delete a CIDR'
|
|
|
|
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)'
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
|
|
|
&'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'
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
|
|
|
&'innernet-server;uninstall'= {
|
2022-09-24 04:16:35 +00:00
|
|
|
cand --yes 'Bypass confirmation'
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
|
|
|
&'innernet-server;serve'= {
|
|
|
|
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)'
|
2021-05-25 07:10:16 +00:00
|
|
|
cand --no-routing 'Whether the routing should be done by innernet or is done by an external tool like e.g. babeld'
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
|
|
|
&'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'
|
2021-11-11 09:42:21 +00:00
|
|
|
cand --invite-expires 'Invite expiration period (eg. ''30d'', ''7w'', ''2h'', ''60m'', ''1000s'')'
|
2021-05-25 07:10:16 +00:00
|
|
|
cand --auto-ip 'Auto-assign the peer the first available IP within the CIDR'
|
|
|
|
cand --yes 'Bypass confirmation'
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
2022-09-24 04:16:35 +00:00
|
|
|
&'innernet-server;disable-peer'= {
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
2022-09-24 04:16:35 +00:00
|
|
|
}
|
|
|
|
&'innernet-server;enable-peer'= {
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
2022-09-24 04:16:35 +00:00
|
|
|
}
|
2021-05-31 15:23:14 +00:00
|
|
|
&'innernet-server;rename-peer'= {
|
|
|
|
cand --name 'Name of peer to rename'
|
|
|
|
cand --new-name 'The new name of the peer'
|
|
|
|
cand --yes 'Bypass confirmation'
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
2021-05-31 15:23:14 +00:00
|
|
|
}
|
2021-05-25 07:10:16 +00:00
|
|
|
&'innernet-server;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'')'
|
2021-05-25 07:10:16 +00:00
|
|
|
cand --parent 'The CIDR parent name'
|
|
|
|
cand --yes 'Bypass confirmation'
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
|
|
|
&'innernet-server;delete-cidr'= {
|
2021-11-11 09:42:21 +00:00
|
|
|
cand --name 'The CIDR name (eg. ''engineers'')'
|
2021-05-25 07:10:16 +00:00
|
|
|
cand --yes 'Bypass confirmation'
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
|
|
|
&'innernet-server;completions'= {
|
2023-06-14 08:49:16 +00:00
|
|
|
cand -h 'Print help'
|
|
|
|
cand --help 'Print help'
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
|
|
|
&'innernet-server;help'= {
|
2023-06-14 08:49:16 +00:00
|
|
|
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'= {
|
2021-05-25 07:10:16 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
$completions[$command]
|
|
|
|
}
|