mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 14:23:09 +00:00
bb108435bb
`wg show` command shows entire interfaces configuration, not just the list. This breaks completion when running fish from root, because command output looks like this: interface: wg0 public key: fred2rX85AxpcTObLuiWTzkRPZaXjnhd1C4XOdZOGWs= private key: (hidden) listening port: 12345 fwmark: 0xca6c peer: g2YHHDkxmgoT9EV0TxKtq556WLXpaOh4zgC5L7EAGTQ= endpoint: 192.168.88.50:54321 allowed ips: 0.0.0.0/0, ::/0 latest handshake: 1 minute, 37 seconds ago transfer: 1.83 MiB received, 927.19 KiB sent To show just the list of active interfaces, `wg show interfaces` should be used instead.
12 lines
722 B
Fish
12 lines
722 B
Fish
set -l valid_subcmds up down strip save
|
|
|
|
function __fish_wg_complete_interfaces
|
|
wg show interfaces
|
|
end
|
|
|
|
complete -c wg-quick -f
|
|
complete -c wg-quick -n "__fish_seen_subcommand_from $valid_subcmds" -a '(__fish_wg_complete_interfaces)'
|
|
complete -c wg-quick -n "not __fish_seen_subcommand_from $valid_subcmds" -a up -d 'Add and set up an interface'
|
|
complete -c wg-quick -n "not __fish_seen_subcommand_from $valid_subcmds" -a down -d 'Tear down and remove an interface'
|
|
complete -c wg-quick -n "not __fish_seen_subcommand_from $valid_subcmds" -a strip -d 'Output config for use with wg'
|
|
complete -c wg-quick -n "not __fish_seen_subcommand_from $valid_subcmds" -a save -d 'Saves the configuration of an existing interface'
|