about summary refs log tree commit diff
path: root/Completion/X/Command/_acroread
blob: c2832d5132920ba8708c594c03a2eb002d68dfa8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#compdef acroread

local curcontext="$curcontext" state line

# Try extracting the version number directly from the executable.
# (This will fail if the executable is a wrapper script for acroread.)
local ver=${${${(Mf)"$(<$commands[$words[1]])"}:#ver=*}##ver=}
[[ -n $ver ]] && _acroread_version=$ver

if (( ! $+_acroread_version )); then
  local acropath=${${(s. .)${${(f)"$($words[1] -help 2>&1)"}[1]}}[2]}
  _acroread_version=${${${(Mf)"$(<$acropath)"}:#ver=*}##ver=}
fi

if [[ $_acroread_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