about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-01-05 15:00:19 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-01-05 15:00:19 +0000
commita7b6805113e5ccf06cf0033e4619af77310a942e (patch)
tree47ecb3b2f39b115badd437b166f07b949f016733
parentacc2cd6b9e4f39c8a81563d4ae93826aa4a334d8 (diff)
downloadzsh-a7b6805113e5ccf06cf0033e4619af77310a942e.tar.gz
zsh-a7b6805113e5ccf06cf0033e4619af77310a942e.tar.xz
zsh-a7b6805113e5ccf06cf0033e4619af77310a942e.zip
zsh-workers/9217
-rw-r--r--Completion/User/_lp9
-rw-r--r--Doc/Zsh/compsys.yo3
2 files changed, 10 insertions, 2 deletions
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
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 331cc5096..9dfaa2af9 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -565,6 +565,9 @@ for communication ports
 item(tt(prefixes))(
 for prefixes (like those of an URL)
 )
+item(tt(printers))(
+for printer names
+)
 item(tt(processes))(
 for process identifiers
 )