about summary refs log tree commit diff
path: root/Completion/Base
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-03 10:57:07 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-03 10:57:07 +0000
commit34048139f90a543f4c1d49c5ff1f49cd3b39720a (patch)
tree4660f35b3a4f9d4882df57c96a2d97998e43ddef /Completion/Base
parentba35c713a116844bd6e5b0d5b31c74cbf7c82c00 (diff)
downloadzsh-34048139f90a543f4c1d49c5ff1f49cd3b39720a.tar.gz
zsh-34048139f90a543f4c1d49c5ff1f49cd3b39720a.tar.xz
zsh-34048139f90a543f4c1d49c5ff1f49cd3b39720a.zip
Initial revision
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/_jobs27
1 files changed, 27 insertions, 0 deletions
diff --git a/Completion/Base/_jobs b/Completion/Base/_jobs
new file mode 100644
index 000000000..869aeeb8a
--- /dev/null
+++ b/Completion/Base/_jobs
@@ -0,0 +1,27 @@
+#autoload
+
+local expl disp jobs job jids
+
+if [[ "$1" = -r ]]; then
+  jids=( "${(@k)jobstates[(R)running*]}" )
+  shift
+  _description expl 'running job'
+elif [[ "$1" = -s ]]; then
+  jids=( "${(@k)jobstates[(R)running*]}" )
+  shift
+  _description expl 'suspended job'
+else
+  [[ "$1" = - ]] && shift
+  jids=( "${(@k)jobtexts}" )
+  _description expl job
+fi
+
+disp=()
+jobs=()
+for job in "$jids[@]"; do
+  disp=( "$disp[@]" "${(l:3:: ::%:)job} -- ${jobtexts[$job]}" )
+  jobs=( "$jobs[@]" "$job" )
+done
+
+compadd "$@" "$expl[@]" -ld disp - "%$^jobs[@]"
+