aboutsummaryrefslogtreecommitdiffstats
path: root/src/_wg-quick
diff options
context:
space:
mode:
authorNicolas Lenz <nicolas@eisfunke.com>2018-08-26 21:16:26 +0200
committerNicolas Lenz <nicolas@eisfunke.com>2018-08-26 21:16:26 +0200
commitc4587d5cf785cd5351854b77f49c2f23a238d87c (patch)
tree0f0ef0807f8b735f796de07b0c32e225dfc312dc /src/_wg-quick
parentFix typo in wg-quick (diff)
downloadzsh-completions-c4587d5cf785cd5351854b77f49c2f23a238d87c.tar
zsh-completions-c4587d5cf785cd5351854b77f49c2f23a238d87c.tar.gz
zsh-completions-c4587d5cf785cd5351854b77f49c2f23a238d87c.tar.bz2
zsh-completions-c4587d5cf785cd5351854b77f49c2f23a238d87c.tar.lz
zsh-completions-c4587d5cf785cd5351854b77f49c2f23a238d87c.tar.xz
zsh-completions-c4587d5cf785cd5351854b77f49c2f23a238d87c.tar.zst
zsh-completions-c4587d5cf785cd5351854b77f49c2f23a238d87c.zip
Use built-in _path_files instead of sed
Diffstat (limited to 'src/_wg-quick')
-rw-r--r--src/_wg-quick10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/_wg-quick b/src/_wg-quick
index 19ea768..8de17ce 100644
--- a/src/_wg-quick
+++ b/src/_wg-quick
@@ -14,14 +14,12 @@
#
# ------------------------------------------------------------------------------
-# 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:interface:(${interfaces})"
+# 1: Complete mode
+# 2: Complete interface with all .conf files in /etc/wireguard without the filename extension.
+_arguments "1:mode:((${modes}))"\
+ '2:interface:_path_files -W /etc/wireguard -g "*.conf(^/:r)"'