about summary refs log tree commit diff
path: root/Completion/Base/Utility
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:10:27 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:10:27 +0000
commitbf2a1aca90328a57d9adb2c6fcb9a98880f11f17 (patch)
tree7c77ed2eb310c11baa90fdbdce900932c1ef35c9 /Completion/Base/Utility
parent2f1832c5e140e72e5b5ae7431062489fd48796ef (diff)
downloadzsh-bf2a1aca90328a57d9adb2c6fcb9a98880f11f17.tar.gz
zsh-bf2a1aca90328a57d9adb2c6fcb9a98880f11f17.tar.xz
zsh-bf2a1aca90328a57d9adb2c6fcb9a98880f11f17.zip
moved from Completion/Core/_compalso
Diffstat (limited to 'Completion/Base/Utility')
-rw-r--r--Completion/Base/Utility/_contexts17
1 files changed, 17 insertions, 0 deletions
diff --git a/Completion/Base/Utility/_contexts b/Completion/Base/Utility/_contexts
new file mode 100644
index 000000000..680f2019f
--- /dev/null
+++ b/Completion/Base/Utility/_contexts
@@ -0,0 +1,17 @@
+#autoload
+
+# This searches $* in the array for normal completions and calls the result.
+# It is used to include completions for another command or special context
+# into the list generated by the calling function.
+# For example the function for `-subscript-' could call this as in
+# `_contexts -math-' to get the completions that would be generated for a
+# mathematical context.
+
+local i tmp ret=1 service
+
+for i; do
+  tmp="$_comps[$i]"
+  [[ -z "$tmp" ]] || service="${_services[$i]:-$i}" && "$tmp" && ret=0
+done
+
+return ret