about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:03:01 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:03:01 +0000
commit422579b1e7cbf5ac15fd111739777e46f15e6808 (patch)
tree6f9f8d5b0a6b29c6701bddb4dc649fc6f9b3dd54 /Completion
parentfe5acd2287b8d3ea19a5cfed8c5f58259650c796 (diff)
downloadzsh-422579b1e7cbf5ac15fd111739777e46f15e6808.tar.gz
zsh-422579b1e7cbf5ac15fd111739777e46f15e6808.tar.xz
zsh-422579b1e7cbf5ac15fd111739777e46f15e6808.zip
moved from Completion/Core/_description
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Core/_description70
1 files changed, 70 insertions, 0 deletions
diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description
new file mode 100644
index 000000000..2c4232ade
--- /dev/null
+++ b/Completion/Base/Core/_description
@@ -0,0 +1,70 @@
+#autoload
+
+local name gropt=-J format gname hidden hide match opts
+
+opts=()
+
+if [[ "$1" = -([12]|)[VJ] ]]; then
+  gropt="$1"
+  shift
+fi
+
+_lastdescr=( "$_lastdescr[@]" "$3" )
+
+zstyle -s ":completion:${curcontext}:$1" group-name gname &&
+    [[ -z "$gname" ]] && gname="$1"
+
+_setup "$1" "${gname:--default-}"
+
+name="$2"
+
+zstyle -s ":completion:${curcontext}:$1" format format ||
+    zstyle -s ":completion:${curcontext}:descriptions" format format
+
+if zstyle -s ":completion:${curcontext}:$1" hidden hidden &&
+   [[ "$hidden" = (all|yes|true|1|on) ]]; then
+  [[ "$hidden" = all ]] && format=''
+  opts=(-n)
+fi
+zstyle -s ":completion:${curcontext}:$1" matcher match &&
+    opts=($opts -M "$match")
+[[ -n "$_matcher" ]] && opts=($opts -M "$_matcher")
+
+if [[ -z "$_comp_no_ignore" ]]; then
+  zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore ||
+    _comp_ignore=()
+
+  zstyle -s ":completion:${curcontext}:$1" ignore-line hidden &&
+    case "$hidden" in
+    true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" "$words[@]" );;
+    current)       _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
+    current-shown) [[ "$compstate[old_list]" = *shown* ]] &&
+                       _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
+    other)         _comp_ignore=( "$_comp_ignore[@]"
+                                  "${(@)words[1,CURRENT-1]}"
+				  "${(@)words[CURRENT+1,-1]}" );;
+    esac
+
+  (( $#_comp_ignore )) && 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
+    set -A "$name" "$opts[@]" "$gropt" "$gname" -X "$format"
+  else
+    set -A "$name" "$opts[@]" "$gropt" "$gname"
+  fi
+else
+  if [[ -n "$format" ]]; then
+    set -A "$name" "$opts[@]" "$gropt" -default- -X "$format"
+  else
+    set -A "$name" "$opts[@]" "$gropt" -default-
+  fi
+fi
+
+return 0