about summary refs log tree commit diff
path: root/Completion/Unix/Command/_lp
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-01-16 20:37:32 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-01-16 20:37:32 +0000
commit6e95fc96020f9d32cae7e48b65c180b9a6263b6e (patch)
tree788e45a21d06af671671719bd31e42459c1b97d7 /Completion/Unix/Command/_lp
parent4f9ee790e0d9f0b3915c2769e0e48c6a7cd8f353 (diff)
downloadzsh-6e95fc96020f9d32cae7e48b65c180b9a6263b6e.tar.gz
zsh-6e95fc96020f9d32cae7e48b65c180b9a6263b6e.tar.xz
zsh-6e95fc96020f9d32cae7e48b65c180b9a6263b6e.zip
28631: gi1242+zsh@gmail.com (as in 28633): completion updates
Diffstat (limited to 'Completion/Unix/Command/_lp')
-rw-r--r--Completion/Unix/Command/_lp196
1 files changed, 102 insertions, 94 deletions
diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp
index e6bff64cc..5d46a75bb 100644
--- a/Completion/Unix/Command/_lp
+++ b/Completion/Unix/Command/_lp
@@ -1,7 +1,5 @@
 #compdef lp lpr lpq lprm lpoptions lpstat
 
-local expl ret=1 printer list disp strs shown
-
 _lp_get_printer()
 {
   # No reason to call _lp_get_printer when service == lpstat. Others matched
@@ -22,6 +20,7 @@ _lp_get_printer()
 
 _lp_job_options()
 {
+  local expl printer
   local -a lopts_with_args lopts_no_args
 
   # Generic options (from lp manual page)
@@ -84,6 +83,9 @@ _lp_job_options()
 
 _lp_list_jobs()
 {
+  local ret=1 printer shown
+  local -a list disp strs
+
   _lp_get_printer
   [[ -n "$printer" ]] && printer=(-P $printer)
 
@@ -125,95 +127,101 @@ _lp_list_jobs()
   return 1
 }
 
-case $service in
-  (lpq)
-    _arguments \
-      '-E[Force encryption]' \
-      '-U:username (for connection to server):_users' \
-      '-h:alternate server:_hosts' \
-      '(-a)-P+[destination printer]:printers:_printers' \
-      '(-P)-a[all printers]' \
-      '-l[long listing]' \
-      '*:poll interval (+seconds):'
-    ;;
-
-  (lprm)
-    _arguments \
-      '-E[Force encryption]' \
-      '-U:username (for connection to server):_users' \
-      '-h:alternate server:_hosts' \
-      '-P+[destination printer]:printers:_printers' \
-      '*:job ids:_lp_list_jobs'
-    ;;
-
-  (lpoptions)
-    _arguments \
-      '-E[Force encryption]' \
-      '-U:username (for connection to server):_users' \
-      '-h:alternate server:_hosts' \
-      '(-p -l -r -x)-d[set default printer]:printers:_printers' \
-      '(-l -x)*-o:job options:_lp_job_options' \
-      '(-d -x)-p[destination printer for options]:printers:_printers' \
-      '(-d -o -r -x)-l[list options]' \
-      '(-d -l -x)*-r:remove option:_lp_job_options' \
-      '(-d -l -r -o)-x[remove all options]:printers:_printers'
-    ;;
-
-  (lpstat)
-    _arguments \
-      '-E[Force encryption]' \
-      '-R[Shows print job ranking]' \
-      '-U:username (for connection to server):_users' \
-      '-W:which jobs:(completed not-completed)' \
-      '-a[Show accepting state]:printers:_printers' \
-      '-c:printer classes:' \
-      '-d[Show current default destination]' \
-      '-h:hostname (alternate server):_hosts' \
-      '-l[long listing]' \
-      '-o[destinations]:printers:_printers' \
-      '-p:printers:_printers' \
-      '-r[CUPS server running status]' \
-      '-s[Status summary]' \
-      '-t[All status info]' \
-      '-u[list jobs by users]:users:_users' \
-      '-v[show devices]:printers:_printers'
-    ;;
-
-  (lpr)
-    _arguments \
-      '-E[Force encryption]' \
-      '-H:hostname (alternate server):_hosts' \
-      '(-C -J -T)'-{C,J,T}':job name:' \
-      '-P+[destination printer]:printers:_printers' \
-      '-U:username (for connection to server):_users' \
-      '-#[Copies]:copies (1--100):' \
-      '-h[Disables banner printing]' \
-      '-l[raw file]' \
-      '-m[Send an email on job completion]' \
-      '*-o:print job options:_lp_job_options' \
-      '-p[format with shaded header incl. date, time etc.]' \
-      '-q[Hold job for printing.]' \
-      '-r[delete files after printing]' \
-      '*:PS/PDF files:_pspdf'
-    ;;
-
-  (lp)
-    _arguments \
-      '-E[Force encryption]' \
-      '-U[username (for connection to server)]:username:_users' \
-      '-c[(OBSOLETE) copy to spool dir before printing]' \
-      '-d[destination printer]:printers:_printers' \
-      '-h:hostname (alternate server):_hosts' \
-      '-i[job id to modify]:job id:' \
-      '-m[Send an email on job completion]' \
-      '-n[Copies]:copies (1--100):' \
-      '*-o:print job options:_lp_job_options' \
-      '-q[Job priority -- 1 (lowest) to 100 (highest)]:priority:' \
-      '-s[Dont report resulting job IDs]' \
-      '-t[Sets the job name]:job name:' \
-      '-u[job submission username]:username:_users' \
-      '-H[Time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \
-      '-P:page range list:' \
-      '*:PS/PDF files:_pspdf'
-    ;;
-esac
+
+_lp()
+{
+  case $service in
+    (lpq)
+      _arguments \
+	'-E[Force encryption]' \
+	'-U:username (for connection to server):_users' \
+	'-h:alternate server:_hosts' \
+	'(-a)-P+[destination printer]:printers:_printers' \
+	'(-P)-a[all printers]' \
+	'-l[long listing]' \
+	'*:poll interval (+seconds):'
+      ;;
+
+    (lprm)
+      _arguments \
+	'-E[Force encryption]' \
+	'-U:username (for connection to server):_users' \
+	'-h:alternate server:_hosts' \
+	'-P+[destination printer]:printers:_printers' \
+	'*:job ids:_lp_list_jobs'
+      ;;
+
+    (lpoptions)
+      _arguments \
+	'-E[Force encryption]' \
+	'-U:username (for connection to server):_users' \
+	'-h:alternate server:_hosts' \
+	'(-p -l -r -x)-d[set default printer]:printers:_printers' \
+	'(-l -x)*-o:job options:_lp_job_options' \
+	'(-d -x)-p[destination printer for options]:printers:_printers' \
+	'(-d -o -r -x)-l[list options]' \
+	'(-d -l -x)*-r:remove option:_lp_job_options' \
+	'(-d -l -r -o)-x[remove all options]:printers:_printers'
+      ;;
+
+    (lpstat)
+      _arguments \
+	'-E[Force encryption]' \
+	'-R[Shows print job ranking]' \
+	'-U:username (for connection to server):_users' \
+	'-W:which jobs:(completed not-completed)' \
+	'-a[Show accepting state]:printers:_printers' \
+	'-c:printer classes:' \
+	'-d[Show current default destination]' \
+	'-h:hostname (alternate server):_hosts' \
+	'-l[long listing]' \
+	'-o[destinations]:printers:_printers' \
+	'-p:printers:_printers' \
+	'-r[CUPS server running status]' \
+	'-s[Status summary]' \
+	'-t[All status info]' \
+	'-u[list jobs by users]:users:_users' \
+	'-v[show devices]:printers:_printers'
+      ;;
+
+    (lpr)
+      _arguments \
+	'-E[Force encryption]' \
+	'-H:hostname (alternate server):_hosts' \
+	'(-C -J -T)'-{C,J,T}':job name:' \
+	'-P+[destination printer]:printers:_printers' \
+	'-U:username (for connection to server):_users' \
+	'-#[Copies]:copies (1--100):' \
+	'-h[Disables banner printing]' \
+	'-l[raw file]' \
+	'-m[Send an email on job completion]' \
+	'*-o:print job options:_lp_job_options' \
+	'-p[format with shaded header incl. date, time etc.]' \
+	'-q[Hold job for printing.]' \
+	'-r[delete files after printing]' \
+	'*:PS/PDF files:_pspdf'
+      ;;
+
+    (lp)
+      _arguments \
+	'-E[Force encryption]' \
+	'-U[username (for connection to server)]:username:_users' \
+	'-c[(OBSOLETE) copy to spool dir before printing]' \
+	'-d[destination printer]:printers:_printers' \
+	'-h:hostname (alternate server):_hosts' \
+	'-i[job id to modify]:job id:' \
+	'-m[Send an email on job completion]' \
+	'-n[Copies]:copies (1--100):' \
+	'*-o:print job options:_lp_job_options' \
+	'-q[Job priority -- 1 (lowest) to 100 (highest)]:priority:' \
+	'-s[Dont report resulting job IDs]' \
+	'-t[Sets the job name]:job name:' \
+	'-u[job submission username]:username:_users' \
+	'-H[Time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \
+	'-P:page range list:' \
+	'*:PS/PDF files:_pspdf'
+      ;;
+  esac
+}
+
+_lp "$@"