1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-20 05:53:52 +01:00
zsh/Completion/Base/_jobs

28 lines
544 B
Plaintext
Raw Normal View History

1999-11-03 11:57:07 +01:00
#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[@]"