From 639d209d626edb6956128f55ce5f4b4920d1019e Mon Sep 17 00:00:00 2001 From: Eisfunke Date: Sat, 4 Aug 2018 15:23:07 +0200 Subject: [PATCH] Add completion script for wireguard's wg-quick --- src/_wg-quick | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/_wg-quick diff --git a/src/_wg-quick b/src/_wg-quick new file mode 100644 index 0000000..8177a1e --- /dev/null +++ b/src/_wg-quick @@ -0,0 +1,27 @@ +#compdef wg-quick +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for wg-quick (a script for easy managemant of wireguard +# VPN tunnels) (https://www.wireguard.com/) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Nicolas Lenz +# +# ------------------------------------------------------------------------------ + +# Take all configuration files (ending with .conf) from /etc/wireguard, +# remove the .conf-parts to get the inferface names +local interfaces=$(ls /etc/wireguard | \ + sed -e "/.conf$/!d" -e "s/.conf$//" 2>/dev/null) + +# The possible modes +local modes=('up\:"bring a wireguard interface up"'\ + 'down\:"tear down and remove a wireguard interface"'\ + 'save\:"save configuration of a running wireguard interface"') + +_arguments "1:mode:((${modes}))" "2:inferface:(${interfaces})"