summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-15 12:01:47 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-15 12:01:47 +0000
commit882a6d2e2cbb08d2397400d55fbaf70fdb5bef18 (patch)
tree156b53ea184d03ea42c1645e71c6bb8c22848a1e /Completion
parent22fe82a7bb6873b5d5aba1702d1d66ba6f325a94 (diff)
downloadzsh-882a6d2e2cbb08d2397400d55fbaf70fdb5bef18.tar.gz
zsh-882a6d2e2cbb08d2397400d55fbaf70fdb5bef18.tar.xz
zsh-882a6d2e2cbb08d2397400d55fbaf70fdb5bef18.zip
Initial revision
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Commands/_complete_help35
-rw-r--r--Completion/Core/_wanted21
2 files changed, 56 insertions, 0 deletions
diff --git a/Completion/Commands/_complete_help b/Completion/Commands/_complete_help
new file mode 100644
index 000000000..cfefdcf90
--- /dev/null
+++ b/Completion/Commands/_complete_help
@@ -0,0 +1,35 @@
+#compdef -k complete-word \C-xh
+
+_complete_help() {
+  local _sort_tags=_help_sort_tags text i
+  typeset -A help_tags
+  typeset -U help_contexts
+
+  help_contexts=()
+
+  compadd() { return 1 }
+
+  _main_complete
+
+  unfunction compadd
+
+  for i in "$help_contexts[@]"; do
+    text="${text}
+tags in context \`${i}': ${help_tags[$i]}"
+  done
+
+  compstate[list]=list
+  compstate[force_list]=yes
+  compstate[insert]=''
+
+  compadd -UX "$text[2,-1]" -n ''
+}
+
+_help_sort_tags() {
+  help_contexts=( "$help_contexts[@]" "$curcontext" )
+  help_tags[$curcontext]="${help_tags[$curcontext]}
+    ${argv}"
+  comptry "$@"
+}
+
+_complete_help "$@"
diff --git a/Completion/Core/_wanted b/Completion/Core/_wanted
new file mode 100644
index 000000000..7baa3e724
--- /dev/null
+++ b/Completion/Core/_wanted
@@ -0,0 +1,21 @@
+#autoload
+
+local targs
+
+if [[ "$1" = -C?* ]]; then
+  targs=( -C "${1[3,-1]}" )
+  shift
+elif [[ "$1" = -C ]]; then
+  targs=( -C "$2" )
+  shift 2
+else
+  targs=()
+fi
+
+[[ "$1" = -(|-) ]] && shift
+
+if [[ $# -gt 1 ]]; then
+  _tags "$targs[@]" "$1" && _description "${(@)argv[2,-1]}"
+else
+  _tags "$targs[@]" "$1"
+fi