completions/wg-quick: Complete files after the subcommand

Fixes #10366
This commit is contained in:
Fabian Boehm 2024-03-12 17:31:53 +01:00
parent a64a50db47
commit 0aa2426552

View file

@ -1,10 +1,12 @@
set -l valid_subcmds up down strip save set -l valid_subcmds up down strip save
function __fish_wg_complete_interfaces function __fish_wg_complete_interfaces
wg show interfaces | string split " " wg show interfaces | string split " " | string replace -r '$' \tInterface
end end
complete -c wg-quick -f # After a command, this takes a config file.
complete -c wg-quick -n "not __fish_seen_subcommand_from $valid_subcmds" -f
complete -c wg-quick -n "__fish_seen_subcommand_from $valid_subcmds" -a '(__fish_wg_complete_interfaces)' 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 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 down -d 'Tear down and remove an interface'