about summary refs log tree commit diff
path: root/Completion/Unix/Command/_rubber
blob: f66540a9f3fd1b86c20da9551480301245011f66 (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
#compdef rubber rubber-pipe rubber-info

local _rubber_version _rubber_path _rubber_modules _rubber_args

eval $(rubber --version 2>/dev/null | sed 's/^.* \([^ ]*\): */_rubber_\1=/')
if [[ ${_rubber_version#0} != $_rubber_version ]]; then
  _rubber_modules=(
    $_rubber_path/rubber/modules/[^_]*.py(N:r:t)
  )
else
  _rubber_modules=(
    $_rubber_path/modules/*.rub(N:r:t)
    $_rubber_path/rubber/rules/latex/[^_]*.py(N:r:t)
  )
fi

_rubber_args=(
  \*{-c,--command}'=[run specified directive command before parsing]:command'
  \*{-e,--epilogue}'=[run specified directive command after parsing]:command'
  '(-z --gzip)'{-z,--gzip}'[compress the final document]'
  '(- *)'{-h,--help}'[show help information]'
  '--into=[go to specified directory before compiling]:directory:_files -/'
  '(-l --landscape)'{-l,--landscape}'[change paper orientation (if relevant)]'
  '(-n --maxerr)'{-n,--maxerr}'=[display at most specified number of errors]:number'
  \*{-m,--module}'=[use module]:module:($_rubber_modules)'
  '--only=[only include the specified sources]:sources'
  \*{-o,--post}'=[postprocess with module]:postprocessor:($_rubber_modules)'
  '(-d --pdf -p -ps)'{-d,--pdf}'[produce PDF output instead of DVI]'
  '(-p -ps -d --pdf)'{-p,--ps}'[produce a PostScript document]'
  {-q,--quiet}'[suppress messages]'
  \*{-r,--read}'[read additional directives from a file]:directives files:_files'
  {-s,--short}'[display errors in compact form]'
  \*{-I,--texpath}'=[add directory to the search path for LaTeX]:tex path:_files -/'
  \*{-v,--verbose}'[increase verbosity]'
  '--version[print version information and exit]'
)

case "$service" in
  rubber)
    _arguments -s \
      "$_rubber_args[@]" \
      '--clean[remove produced files instead of compiling]' \
      {-f,--force}'[force at least one compilation]' \
      '--inplace[compile the documents from their source directory]' \
      \*{-W,--warn}'=[report warnings of the given type]:warnings:(all boxes misc refs)' \
      '*:LaTeX files:_files -g "*.(tex|dtx|lhs|w)(-.)"'
	;;
	
  rubber-pipe)
    _arguments -s \
      "$_rubber_args[@]" \
      {-k,--keep}'[keep the temporary files after compiling]' \
      \*{-W,--warn}'=[report warnings of the given type]:warnings:(all boxes misc refs)'
	;;
	
  rubber-info)
    _arguments -s \
      "$_rubber_args[@]" \
      '--boxes[report overfull and underfull boxes]' \
      '--check[report errors or warnings default action]' \
      '--deps[show the target file s dependencies]' \
      '--errors[show all errors that occured during compilation]' \
      '--refs[show the list of undefined references]' \
      '--warnings[show all LaTeX warnings]' \
      ':LaTeX file:_files -g "*.(tex|dtx|lhs|w)(-.)"'
  ;;
esac