about summary refs log tree commit diff
path: root/Completion/Core/_description
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core/_description')
-rw-r--r--Completion/Core/_description54
1 files changed, 44 insertions, 10 deletions
diff --git a/Completion/Core/_description b/Completion/Core/_description
index 874ba8a96..7db47228b 100644
--- a/Completion/Core/_description
+++ b/Completion/Core/_description
@@ -1,22 +1,56 @@
 #autoload
 
-local gropt=-J
+local name gropt=-J format gname hidden hide match opts
 
-if [[ "$1" = -V ]]; then
-  gropt=-V
+opts=()
+
+if [[ "$1" = -([12]|)[VJ] ]]; then
+  gropt="$1"
   shift
 fi
 
-if [[ -n "$compconfig[group_matches]" ]]; then
-  if [[ -n "$compconfig[description_format]" ]]; then
-    eval "$1=($gropt ${(q)2} -X ${(q)compconfig[description_format]//\\%d/$2})"
+_lastdescr=( "$_lastdescr[@]" "$3" )
+
+_setup "$1"
+
+name="$2"
+
+zstyle -s ":completion:${curcontext}:$1" format format ||
+    zstyle -s ":completion:${curcontext}:descriptions" format format
+
+zstyle -s ":completion:${curcontext}:$1" hidden hidden
+if [[ "$hidden" = (all|yes|true|1|on) ]]; then
+  [[ "$hidden" = all ]] && format=''
+  opts=(-n)
+fi
+zstyle -s ":completion:${curcontext}:$1" group-name gname &&
+    [[ -z "$gname" ]] && gname="$1"
+zstyle -s ":completion:${curcontext}:$1" matcher match &&
+    opts=($opts -M "${(q)match}")
+[[ -n "$_matcher" ]] && opts=($opts -M "${(q)_matcher}")
+
+if [[ -z "$_comp_no_ignore" ]] &&
+   zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then
+  opts=( $opts -F _comp_ignore )
+else
+  _comp_ignore=()
+fi
+
+shift 2
+[[ -n "$format" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
+
+if [[ -n "$gname" ]]; then
+  if [[ -n "$format" ]]; then
+    eval "${name}=($opts $gropt ${(q)gname} -X \"${format}\")"
   else
-    eval "$1=($gropt ${(q)2})"
+    eval "${name}=($opts $gropt ${(q)gname})"
   fi
 else
-  if [[ -n "$compconfig[description_format]" ]]; then
-    eval "$1=(-X ${(q)compconfig[description_format]//\\%d/$2})"
+  if [[ -n "$format" ]]; then
+    eval "${name}=($opts $gropt -default- -X \"${format}\")"
   else
-    eval "$1=()"
+    eval "${name}=($opts $gropt -default-)"
   fi
 fi
+
+return 0