From a7b6805113e5ccf06cf0033e4619af77310a942e Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Wed, 5 Jan 2000 15:00:19 +0000 Subject: zsh-workers/9217 --- Completion/User/_lp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/User') diff --git a/Completion/User/_lp b/Completion/User/_lp index f37c62a14..dd7330343 100644 --- a/Completion/User/_lp +++ b/Completion/User/_lp @@ -1,6 +1,6 @@ #compdef lp lpr lpq lprm -local file expl ret=1 list disp strs shown +local file expl ret=1 printer list disp strs shown if (( ! $+_lp_cache )); then file=( /etc/(printcap|printers.conf)(N) ) @@ -18,7 +18,12 @@ if compset -P -P || [[ "$words[CURRENT-1]" = -P ]]; then _wanted printers expl printer && compadd "$expl" - "$_lp_cache[@]" else if [[ "$words[1]" = (lpq|lprm) ]]; then - list=( "${(@M)${(f@)$(lpq)}:#[0-9]*}" ) + if [[ "$words" = *-P* ]]; then + printer=(-P "${${words##*-P( |)}%% *}") + else + printer=() + fi + list=( ${(M)"${(f@)$(lpq $printer 2> /dev/null)}":#[0-9]*} ) if (( $#list )); then _tags users jobs -- cgit 1.4.1