mirror of
https://github.com/zsh-users/zsh-completions.git
synced 2026-09-17 16:00:19 +00:00
Use built-in _path_files instead of sed
This commit is contained in:
+4
-6
@@ -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)"'
|
||||
|
||||
Reference in New Issue
Block a user