about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-12-23 22:09:28 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-12-23 22:09:28 +0000
commit6a72c271122268089ed88c6a5c1593b379572949 (patch)
tree5bfbbeee070b3ca6029715b2fee3e2235c4523b4
parentaac49ecdbd155c75e06f2632fc66f065c26c75b2 (diff)
downloadzsh-6a72c271122268089ed88c6a5c1593b379572949.tar.gz
zsh-6a72c271122268089ed88c6a5c1593b379572949.tar.xz
zsh-6a72c271122268089ed88c6a5c1593b379572949.zip
zsh-workers/9150
-rw-r--r--Completion/Builtins/.distfiles2
-rw-r--r--Completion/Builtins/_zstyle177
-rw-r--r--Test/.distfiles3
3 files changed, 180 insertions, 2 deletions
diff --git a/Completion/Builtins/.distfiles b/Completion/Builtins/.distfiles
index ae7d9fac9..e142d0e08 100644
--- a/Completion/Builtins/.distfiles
+++ b/Completion/Builtins/.distfiles
@@ -4,5 +4,5 @@ DISTFILES_SRC='
     _compdef _disable _echotc _enable _fc _fg_jobs _functions _hash _kill
     _limits _nothing _pids _popd _sched _set _setopt _source _stat _trap
     _unhash _unsetopt _vars _vars_eq _wait _which _zftp _zle _zmodload
-    _signals
+    _signals _zstyle
 '
diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle
new file mode 100644
index 000000000..f072f79ae
--- /dev/null
+++ b/Completion/Builtins/_zstyle
@@ -0,0 +1,177 @@
+#compdef zstyle
+
+local curcontext="$curcontext" state ostate line expl ctop
+local nm=$compstat[nmatches]
+
+typeset -A styles
+# Assoc array of styles; the values give the possible top-level
+# contexts (currently c for completion, z for zftp or cz for both),
+# followed by a colon, followed by a state to enter, empty if none.
+styles=(
+  accept-exact		 c:bool
+  arguments		 c:
+  auto-description	 c:
+  cache-path		 'c:_path_files -/'
+  completer		 c:completer
+  completions		 c:
+  condition		 c:
+  cursor		 c:bool
+  disable-stat		 c:bool
+  expand		 c:
+  format		 c:
+  glob			 c:
+  group-name		 c:
+  group-order		 c:tag
+  groups		 c:_groups
+  hidden		 c:bool
+  hosts			 c:_hosts
+  hosts-ports		 c:host-port
+  hosts-ports-users	 c:host-port-user
+  ignored-suffixes	 c:
+  insert-unambiguous	 c:bool
+  last-prompt		 c:bool
+  list			 c:listwhen
+  list-arguments	 c:
+  list-colors		 c:
+  list-packed		 c:bool
+  list-rows-first	 c:bool
+  local			 c:
+  max-errors		 c:
+  menu			 c:boolauto
+  numbers		 c:bool
+  original		 c:bool
+  path			 'c:_path_files -/'
+  ports			 c:_ports
+  prefix-hidden		 c:bool
+  prefix-needed		 c:bool
+  prompt		 c:
+  remove-all-dups	 c:bool
+  sort			 c:bool
+  tag-order		 c:tag
+  special-dirs		 c:sdirs
+  stop			 c:stop
+  substitute		 c:
+  users			 c:_users
+  users-hosts		 c:user-host
+  verbose		 c:bool
+  word			 c:bool
+
+  chpwd			 z:bool
+  progress		 z:progress
+  remote_glob		 z:bool
+  titlebar		 z:bool
+  update		 z:
+)
+
+local taglist
+taglist=(accounts all-files all-expansions arguments arrays
+association-keys bookmarks builtins characters colors commands corrections
+cursors cvs default descriptions devices directories directory-stack
+displays expansions extensions files fonts functions globbed-files groups
+history-words hosts indexes jobs keymaps keysyms local-directories
+libraries limits manuals maps messages modifiers modules my-accounts
+named-directories names nicknames options original other-accounts packages
+parameters path-directories paths pods ports prefixes processes ps regex
+sequences sessions signals strings tags targets types urls users values
+warnings widgets windows zsh-options)
+
+_arguments ':context:->contexts' ':style:->styles' '*:argument:->style-arg'
+
+while [[ -n $state ]]; do
+  ostate=$state
+  state=
+
+  case "$ostate" in
+    contexts)
+      if [[ $PREFIX != :*: ]]; then
+	_wanted contexts expl context &&
+	compadd -P : -S : "$expl[@]" completion zftp
+      fi
+      ;;
+
+    styles)
+      # Get the top-level context we're completing for, if any.
+      if [[ $words[2] = :(completion|zftp):* ]]; then
+	ctop=${words[2][2]}
+      else
+        ctop=cz
+      fi
+      _wanted styles expl style &&
+         compadd "$expl[@]" - ${(k)styles[(R)[^:]#[$ctop][^:]#:*]}
+      ;;
+      
+    style-arg)
+      state="${styles[$words[3]]#*:}"
+      ;;
+
+    bool) 
+      _wanted values expl boolean &&
+	compadd "$expl[@]" true false
+      ;;
+
+    boolauto) 
+      _wanted values expl boolean &&
+	compadd "$expl[@]" true false auto select
+      ;;
+
+    completer)
+      _wanted values expl completer &&
+	compadd "$expl[@]" _complete _approximate _correct _match \
+          _expand _list _menu _oldlist
+      ;;
+
+    host-port*)
+      if [[ $PREFIX != *:* ]]; then
+	_hosts -S :
+      elif [[ $ostate != *user || $PREFIX != *:*:* ]]; then
+	compset -P 1 '*:'
+	_ports
+      else
+	compset -P 2 '*:'
+        _users
+      fi
+      ;;
+
+    listwhen)
+      _wanted values expl 'when to list completions' &&
+	compadd "$expl[@]" always never sometimes
+      ;;
+
+    progress)
+      _wanted values expl 'progress meter style' &&
+        compadd "$expl[@]" none bar percent
+      ;;
+
+    sdirs)
+      _wanted values expl 'whether to complete . or ..' &&
+        compadd "$expl[@]" true false ..
+      ;;
+
+    stop)
+      _wanted values expl 'when to insert matches' &&
+	compadd "$expl[@]" true false verbose
+      ;;
+
+    tag)
+      _wanted tags expl tag && compadd "$expl[@]" - $taglist
+      ;;
+
+    user-host)
+      if [[ $PREFIX = *:* ]]; then
+	compset -P '*:'
+	_hosts
+      else
+	_users
+      fi
+      ;;
+
+    _*)
+      ${=ostate}
+      ;;
+
+    *)
+      ;;
+  esac
+done
+
+[[ $compstate[nmatches] != $nm ]]
diff --git a/Test/.distfiles b/Test/.distfiles
index 3317551c9..11b5719a2 100644
--- a/Test/.distfiles
+++ b/Test/.distfiles
@@ -1,5 +1,6 @@
 DISTFILES_SRC='
     .cvsignore .distfiles Makefile.in
     ztst.zsh
-    01grammar.ztst 02alias.ztst 03quoting.ztst 50cd.ztst
+    01grammar.ztst 02alias.ztst 03quoting.ztst 04redirect.ztst
+    05command.ztst 06arith.ztst 07cond.ztst 50cd.ztst
 '