edit:completion:arg-completer[innernet-server] = [@words]{ fn spaces [n]{ repeat $n ' ' | joins '' } fn cand [text desc]{ edit:complex-candidate $text &display-suffix=' '(spaces (- 14 (wcswidth $text)))$desc } command = 'innernet-server' for word $words[1:-1] { if (has-prefix $word '-') { break } command = $command';'$word } completions = [ &'innernet-server'= { 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 --no-routing 'Whether the routing should be done by innernet or is done by an external tool like e.g. babeld' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' 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 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 'Prints 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 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' } &'innernet-server;uninstall'= { cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' } &'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: 1420 for IPv4 and 1400 for IPv6)' cand --no-routing 'Whether the routing should be done by innernet or is done by an external tool like e.g. babeld' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' } &'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 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' } &'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 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' } &'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 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' } &'innernet-server;delete-cidr'= { cand --name 'The CIDR name (eg. "engineers")' cand --yes 'Bypass confirmation' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' } &'innernet-server;completions'= { cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' } &'innernet-server;help'= { cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' } ] $completions[$command] }