2000-01-05 15:14:46 +01:00
|
|
|
#compdef lp lpr lpq lprm
|
|
|
|
|
2000-04-01 22:43:43 +02:00
|
|
|
local expl ret=1 printer list disp strs shown
|
2000-01-05 15:14:46 +01:00
|
|
|
|
|
|
|
if compset -P -P || [[ "$words[CURRENT-1]" = -P ]]; then
|
2000-04-28 13:20:55 +02:00
|
|
|
_printers
|
2000-01-05 15:14:46 +01:00
|
|
|
else
|
2001-01-15 10:11:31 +01:00
|
|
|
if [[ "$service" = (lpq|lprm) ]]; then
|
2000-04-01 22:43:43 +02:00
|
|
|
if [[ "$words" = *-P* ]]; then
|
|
|
|
printer=(-P "${${words##*-P( |)}%% *}")
|
|
|
|
else
|
|
|
|
printer=()
|
|
|
|
fi
|
|
|
|
list=( ${(M)"${(f@)$(_call jobs lpq $printer 2> /dev/null)}":#[0-9]*} )
|
2000-01-05 15:14:46 +01:00
|
|
|
|
|
|
|
if (( $#list )); then
|
|
|
|
_tags users jobs
|
|
|
|
|
|
|
|
while _tags; do
|
2000-04-01 22:43:43 +02:00
|
|
|
if _requested users; then
|
2000-01-05 15:14:46 +01:00
|
|
|
strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" )
|
|
|
|
if [[ -z "$shown" ]] &&
|
2000-04-01 22:43:43 +02:00
|
|
|
zstyle -T ":completion:${curcontext}:users" verbose; then
|
2000-01-05 15:14:46 +01:00
|
|
|
disp=(-ld list)
|
|
|
|
shown=yes
|
|
|
|
else
|
|
|
|
disp=()
|
|
|
|
fi
|
2000-05-31 11:38:25 +02:00
|
|
|
_all_labels users expl user compadd "$disp[@]" -a strs ||
|
2000-04-01 22:43:43 +02:00
|
|
|
_users && ret=0
|
2000-01-05 15:14:46 +01:00
|
|
|
fi
|
2000-04-01 22:43:43 +02:00
|
|
|
if _requested jobs; then
|
2000-01-05 15:14:46 +01:00
|
|
|
strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" )
|
|
|
|
if [[ -z "$shown" ]] &&
|
2000-04-01 22:43:43 +02:00
|
|
|
zstyle -T ":completion:${curcontext}:jobs" verbose; then
|
2000-01-05 15:14:46 +01:00
|
|
|
disp=(-ld list)
|
|
|
|
shown=yes
|
|
|
|
else
|
|
|
|
disp=()
|
|
|
|
fi
|
2000-05-31 11:38:25 +02:00
|
|
|
_all_labels jobs expl job compadd "$disp[@]" -a strs && ret=0
|
2000-01-05 15:14:46 +01:00
|
|
|
fi
|
|
|
|
(( ret )) || return 0
|
|
|
|
done
|
|
|
|
else
|
|
|
|
_message 'no print jobs'
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
else
|
|
|
|
_ps
|
|
|
|
fi
|
|
|
|
fi
|