1#compdef rubber rubber-pipe rubber-info 2 3local _rubber_version _rubber_path _rubber_modules _rubber_args 4 5eval $(rubber --version 2>/dev/null | sed 's/^.* \([^ ]*\): */_rubber_\1=/') 6if [[ ${_rubber_version#0} != $_rubber_version ]]; then 7 _rubber_modules=( 8 $_rubber_path/rubber/modules/[^_]*.py(N:r:t) 9 ) 10else 11 _rubber_modules=( 12 $_rubber_path/modules/*.rub(N:r:t) 13 $_rubber_path/rubber/rules/latex/[^_]*.py(N:r:t) 14 ) 15fi 16 17_rubber_args=( 18 \*{-c,--command}'=[run the directive CMD before parsing]:command' 19 \*{-e,--epilogue}'=[run the directive CMD after parsing]:command' 20 {-z,--gzip}'[compress the final document]' 21 '(- *)'{-h,--help}'[show help]' 22 '--into=[go to directory DIR before compiling]:directory:_files -/' 23 {-l,--landscape}'[change paper orientation (if relevant)]' 24 {-n,--maxerr}'=[display at most NUM errors]:num' 25 \*{-m,--module}'=[use module]:module:($_rubber_modules)' 26 '--only=[only include the specified SOURCES]:sources' 27 \*{-o,--post}'=[postprocess with module]:postprocessor:($_rubber_modules)' 28 {-d,--pdf}'[produce PDF output instead of DVI]' 29 {-p,--ps}'[produce a PostScript document]' 30 {-q,--quiet}'[suppress messages]' 31 \*{-r,--read}'[read additional directives from a file]:directives files:_files' 32 {-s,--short}'[display errors in a compact form]' 33 \*{-I,--texpath}'=[add DIR to the search path for LaTeX]:tex path:_files -/' 34 \*{-v,--verbose}'[increase verbosity]' 35 '--version[print version information and exit]' 36) 37 38case "$service" in 39 rubber) 40 _arguments -s \ 41 "$_rubber_args[@]" \ 42 '--clean[remove produced files instead of compiling]' \ 43 {-f,--force}'[force at least one compilation]' \ 44 '--inplace[compile the documents from their source directory]' \ 45 \*{-W,--warn}'=[report warnings of the given TYPE]:warnings:(all boxes misc refs)' \ 46 '*:LaTeX files:_files -g "*.(tex|dtx|lhs|w)(-.)"' 47 return 0 48 ;; 49 50 rubber-pipe) 51 _arguments -s \ 52 "$_rubber_args[@]" \ 53 {-k,--keep}'[keep the temporary files after compiling]' \ 54 \*{-W,--warn}'=[report warnings of the given TYPE]:warnings:(all boxes misc refs)' 55 return 0 56 ;; 57 58 rubber-info) 59 _arguments -s \ 60 "$_rubber_args[@]" \ 61 '--boxes[report overfull and underfull boxes]' \ 62 '--check[report errors or warnings default action]' \ 63 '--deps[show the target file s dependencies]' \ 64 '--errors[show all errors that occured during compilation]' \ 65 '--refs[show the list of undefined references]' \ 66 '--warnings[show all LaTeX warnings]' \ 67 ':LaTeX file:_files -g "*.(tex|dtx|lhs|w)(-.)"' 68 return 0 69 ;; 70esac 71 72return 1 73