about summary refs log tree commit diff
path: root/Completion/User/_ports
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User/_ports')
-rw-r--r--Completion/User/_ports12
1 files changed, 8 insertions, 4 deletions
diff --git a/Completion/User/_ports b/Completion/User/_ports
index 950212832..958917bd6 100644
--- a/Completion/User/_ports
+++ b/Completion/User/_ports
@@ -1,8 +1,12 @@
 #autoload
 
-local expl
+local expl ports
 
-: ${(A)ports:=${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/tcp}%%[ 	]*}}
+if ! zstyle -a ":completion:${curcontext}:" ports ports; then
+  (( $+_cache_ports )) ||
+      : ${(A)_cache_ports:=${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/tcp}%%[ 	]*}}
 
-_description expl port
-compadd "$@" "$expl[@]" - "$ports[@]"
+  ports=( "$_cache_ports[@]" )
+fi
+
+_wanted ports expl port compadd "$@" -a ports