about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-10-26 15:36:11 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-10-26 15:36:11 +0000
commit65392c396bc521661593d1fa028b8a2d0b2461af (patch)
treee9ab8ff5c234264fdf3d57053250330bec88ee89 /Completion
parent520116ec683392ccf8a905dd01768865a390de85 (diff)
downloadzsh-65392c396bc521661593d1fa028b8a2d0b2461af.tar.gz
zsh-65392c396bc521661593d1fa028b8a2d0b2461af.tar.xz
zsh-65392c396bc521661593d1fa028b8a2d0b2461af.zip
Initial revision
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/_job26
1 files changed, 26 insertions, 0 deletions
diff --git a/Completion/Base/_job b/Completion/Base/_job
new file mode 100644
index 000000000..081956c51
--- /dev/null
+++ b/Completion/Base/_job
@@ -0,0 +1,26 @@
+#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:2:: :)job}] ${jobtexts[$job]}" )
+  jobs=( "$jobs[@]" "$job" )
+done
+
+compadd "$@" "$expl[@]" -ld disp - "$jobs[@]"