Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Updated _acroread completer
- X-seq: zsh-workers 21139
- From: Haakon Riiser <haakon.riiser@xxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Updated _acroread completer
- Date: Thu, 14 Apr 2005 15:47:03 +0200
- Mail-followup-to: zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
I just wrote an updated version of _acroread that works for both
acroread 5 and 7. Unfortunately, determining the version number
involves running acroread -help, which is a bit slow. I was
thinking about caching the version number, but I'm not sure what's
the recommended way of doing that. Is it OK if I just set a non-
local variable _acroread_version?
Anyway, here's what I got so far:
#------------------------------------------------------------------------------#
#compdef acroread
local curcontext="$curcontext" state line
# The output of acroread -version cannot be piped to stdout for some reason, so
# the version number must be read from ACROREAD-PREFIX/Reader/AcroVersion.
# Since acroread might have been started via a wrapper script, the only
# failsafe way of determining ACROREAD-PREFIX is to look at the output of
# acroread -help. TODO: running acroread -help is slow - can version be cached
# for a single shell session?
local acropath=${${(s. .)${${(f)"$($words[1] -help 2>&1)"}[1]}}[2]}
local version=$(< ${acropath%/*}/../Reader/AcroVersion)
if [[ $version == 7.* ]]; then
_arguments -C \
'--display=:X display:_x_display' \
'--screen=:X screen (overrides the screen part of DISPLAY)' \
--sync \
'-geometry:[<width>x<height>][{+|-}<x offset>{+|-}<y offset>]' \
-help \
-iconic \
'*-setenv:<var>=<value>' \
-tempFile \
'-tempFileTitle:title' \
-openInNewWindow \
-version \
'-visual:X visual:_x_visual' \
'-toPostScript:*::PostScript conversion options:= ->tops' \
'*:PDF file:_files -g "*.(#i)pdf(-.)"' && return
[[ -n "$state" ]] && _arguments \
'-pairs:*:pdf_file_1 ps_file_1 ...:_files -g "*.(#i)(pdf|ps)(-.)"' \
-binary \
'-start:integer' \
'-end:integer' \
-optimizeForSpeed \
-landscape \
-reverse \
'(-even)-odd' \
'(-odd)-even' \
-commentsOff \
-annotsOff \
'(-level3)-level2' \
'(-level2)-level3' \
-printerhalftones \
-saveVM \
'-scale:integer' \
-shrink \
-expand \
'-size:page size (or custom size wxh in points):(letter tabloid ledger legal executive a3 a4 a5 b4 b5)' \
'-transQuality:transparency flattening level:(1 2 3 4 5)' \
'*:PDF file:_files -g "*.(#i)pdf(-.)"' && return
else
_x_arguments -C \
-help \
-helpall \
\*-iconic \
\*+iconic \
'-name:application name:_x_name' \
'*-setenv:<var>=<value>' \
-tempFile \
'-tempFileTitle:title' \
'(+useFrontEndProgram)-useFrontEndProgram' \
'(-useFrontEndProgram)+useFrontEndProgram' \
'-visual:X visual:_x_visual' \
'-xrm:X resource specification:_x_resource' \
'-toPostScript:*::PostScript conversion options:= ->tops' \
'*:PDF file:_files -g "*.(#i)pdf(-.)"' && return
[[ -n "$state" ]] && _arguments \
'-pairs:*:pdf_file_1 ps_file_1 ...:_files -g "*.(#i)(pdf|ps)(-.)"' \
-binary \
'-start:integer' \
'-end:integer' \
-optimizeForSpeed \
-landscape \
-reverse \
'(-even)-odd' \
'(-odd)-even' \
-commentsOff \
'(-level2 -level3)-level1' \
'(-level1 -level3)-level2' \
'(-level1 -level2)-level3' \
-printerhalftones \
-saveVM \
'-scale:integer' \
-shrink \
'-size:page size (or custom size wxh in points):(letter tabloid ledger legal executive a3 a4 a5 b4 b5)' \
'-transQuality:transparency flattening level:(1 2 3 4 5)' \
'*:PDF file:_files -g "*.(#i)pdf(-.)"' && return
fi
return 1
#------------------------------------------------------------------------------#
--
Haakon
Messages sorted by:
Reverse Date,
Date,
Thread,
Author