Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: update completion for libtiff tools



These haven't been updated in years. There aren't all that many changes,
however. Much of the patch amounts to adding '+' to lots of option
specifications because arguments are accepted in the same word as the
option.

Not all of the libtiff tools are handled - I don't think that ever was
the case. A few are handled that I don't seem to have on my system
anymore, e.g. gif2tiff. I've added new handling of tiff2pdf.

Oliver

diff --git a/Completion/Unix/Command/_tiff b/Completion/Unix/Command/_tiff
index 588476d5a..128aeb0c0 100644
--- a/Completion/Unix/Command/_tiff
+++ b/Completion/Unix/Command/_tiff
@@ -14,7 +14,7 @@ if [[ $# -ne 0 || $+_in_tiff -ne 0 ]]; then
     set -- "$expl[@]"
   fi
   _wanted files expl 'picture file' _path_files "$@" -g "$pat" - ||
-      _files "$@" "$expl[@]" -g '*.(#i)tiff(-.)'
+      _files "$@" "$expl[@]" -g '*.(#i)tif(|f)(-.)'
   return
 fi
 
@@ -26,87 +26,143 @@ typeset -A opt_args
 case "$service" in
 tiff2bw)
   _arguments -C \
-    '-c[specify compression scheme]:compression scheme:->compress' \
-    '-r[specify rows per strip]:rows per strip' \
-    '-R[specify percentage of red channel]:percentage of red channel' \
-    '-G[specify percentage of green channel]:percentage of green channel' \
-    '-B[specify percentage of blue channel]:percentage of blue channel' \
+    '-c+[specify compression scheme]:compression scheme:->compress' \
+    '-r+[specify rows per strip]:rows per strip' \
+    '-R+[specify percentage of red channel]:percentage' \
+    '-G+[specify percentage of green channel]:percentage' \
+    '-B+[specify percentage of blue channel]:percentage' \
     ':input file:_files -g "*.(#i)tif(|f)(-.)"' \
     ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
+tiff2pdf)
+  _arguments -s \
+    '-o+[specify output file]:output file:_files -g "*.(#i)pdf(-.)"' \
+    '(-z -d)-j[compress with JPEG]' \
+    '(-j -d)-z[compress with Zip/Deflate]' \
+    '-q+[specify compression quality]:quality' \
+    '-n[no compressed data passthrough]' \
+    "(-z -j)-d[don't compress]" \
+    '-i[invert colors]' \
+    '-u+[set distance unit]:unit:((i\:inches m\:centimeters))' \
+    '-x+[set x resolution]:resolution (dots per unit)' \
+    '-y+[set y resolution]:resolution (dots per unit)' \
+    '-w+[specify width in units]:width' \
+    '-l+[specify length in units]:length' \
+    '-r+[specify scope for resolution settings]:scope:((d\:images\ without\ resolution o\:all\ images))' \
+    '-p+[specify paper size]:paper size:(letter legal A4)' \
+    '-F[make the tiff fill the PDF page]' \
+    '-f[set PDF "Fit Window" user preference]' \
+    '-e+[specify date]:date (YYYYMMDDHHMMSS)' \
+    '-c+[set document creator, overrides image software default]:creator' \
+    '-a+[set document author, overrides image artist default]:author' \
+    '-t+[set document title, overrides image document name default]:title' \
+    '-s+[set document subject, overrides image image description default]:subject' \
+    '-k+[set document keywords]:keywords' \
+    '-b[set PDF "Interpolate" user preference]' \
+    '(- :)-h[display usage information]' \
+    ':input file:_files -g "*.(#i)tif(|f)(-.)"'
+  ;;
 tiff2ps)
-  _arguments \
-    '-1[generate PostScript Level I output]' \
-    '-2[generate PostScript Level II output]' \
+  _arguments -s \
+    '!(-2 -3 -8 -m)-1' \
+    '(-3)-2[generate PostScript Level 2 output]' \
+    '(-2)-3[generate PostScript Level 3 output]' \
+    '-8[disable use of ASCII85 encoding with PostScript Level 2/3]' \
     '-a[generate output for all IFDs]' \
-    '-d[set initial TIFF directory]:initial TIFF directory' \
-    '(-p)-e[generate Encapsulated PostScript]' \
-    '-o[set initial TIFF directory (file offset)]:file offset' \
+    '-b+[set the bottom margin]:margin (inches)' \
+    '-c[center image]' \
+    '-C+[set postscript document creator name]:creator' \
+    '-d+[set initial TIFF directory]:initial TIFF directory' \
+    '(-e)-D[print two pages per sheet (duplex)]' \
+    '(-p -D -T)-e[generate Encapsulated PostScript]' \
+    '-h+[set printed page height]:height (inches)' \
+    '-w+[set printed page width]:width (inches)' \
+    '(-W)-H+[split image if height is more than specified value]:limit (inches)' \
+    '(-H)-W+[split image if width is more than specified value]:limit (inches)' \
+    '-L+[specify overlap for split images]:overlap (inches)' \
+    '-i+[enable/disable (Nz/0) pixel interpolation]:state [enabled]:((0\:disable 1\:enable))' \
+    '-l+[set the left margin]:margin (inches)' \
+    '-m[use "imagemask" operator instead of "image"]' \
+    '-o+[set initial TIFF directory (file offset)]:file offset (bytes)' \
     '(-e)-p[generate non-Encapsulated PostScript]' \
-    '-h[set page height]:page height' \
-    '-w[set page width]:page width' \
-    '-8[disable use of ASCII85 encoding]' \
-    '-D[print two pages per sheet]' \
-    '-O[specify output file]:output file:_files -g "*.(#i)ps(-.)"' \
+    '-O+[specify output file]:output file:_files -g "*.(#i)(|e)ps(-.)"' \
+    '-P+[set PageOrientation DSC comment to Landscape or Portrait]:orientation:(L P)' \
+    '-r+[rotate image]:rotation:(90 180 270 auto)' \
     '-s[generate output for a single image]' \
-    '-T[print pages for top edge binding]' \
+    '-t+[set postscript document title]:title' \
+    '(-e)-T[print pages for top edge binding]' \
+    '(-y)-x[override resolution units as centimeters]' \
+    '(-x)-y[override resolution units as inches]' \
+    '-z[enable printing in the deadzone]' \
     '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
 tiffcmp)
-  _arguments \
+  _arguments -s \
     '-l[list all differing bytes]' \
+    '-z+[list specified number of bytes that differs between the files]:bytes' \
     '-t[ignore differences in directories]' \
     ':first input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' \
     ':second input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
 tiffcp)
-  _arguments -C \
-    '-B[write output in bin-endian byte order]' \
-    '-c[specify compression scheme]:compression scheme:->compress' \
-    '-o[set initial TIFF directory (file offset)]:file offset' \
-    '-p[set sample packing]:sample packing:(contig separate)' \
+  _arguments -C -s \
+    '-a[append to output instead of overwriting]' \
+    '-c+[specify compression scheme]:compression scheme:->compress' \
+    '-o+[set initial TIFF directory (file offset)]:file offset' \
+    '-p+[set sample packing]:sample packing:(contig separate)' \
     '(-t)-s[write output in strips]' \
     '(-s)-t[write output in tiles]' \
+    '-x[force the merged tiff pages in sequence]' \
+    '-8[write BigTIFF instead of default ClassicTIFF]' \
+    '(-L)-B[write output in big-endian byte order instead of native ordering]' \
+    '(-B)-L[write output in little-endian byte order instead of native ordering]' \
+    '-M[disable use of memory-mapped files]' \
+    '-C[disable strip chopping]' \
     '-i[ignore read errors]' \
-    '-r[specify rows per strip]:rows per strip' \
-    '-w[specify output tile width]:output tile width' \
-    '-l[specify output tile length]:output tile length' \
-    '-f[specify fill order]:fill order:(lsb2msb msb2lsb)' \
-    '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
+    '-b+[specify bias (dark) monochrome image to be subtracted from all others]:file:_files' \
+    '-,=-[specify substitute character for image indices]:character [,]' \
+    '-r+[specify rows per strip]:rows per strip' \
+    '-w+[specify output tile width]:output tile width' \
+    '-l+[specify output tile length]:output tile length' \
+    '-f+[specify fill order]:fill order:(lsb2msb msb2lsb)' \
+    '*:TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
 tiffdither)
   _arguments -C \
-    '-c[specify compression scheme]:compression scheme:->compress' \
-    '-f[specify fill order]:fill order:(lsb2msb msb2lsb)' \
-    '-r[specify rows per strip]:rows per strip' \
-    '-t[set threshold for dithering]:dither threshold value' \
+    '-c+[specify compression scheme]:compression scheme:->compress' \
+    '-f+[specify fill order]:fill order:(lsb2msb msb2lsb)' \
+    '-r+[specify rows per strip]:rows per strip' \
+    '-t+[set threshold for dithering]:dither threshold value [128]' \
     ':input file:_files -g "*.(#i)tif(|f)(-.)"' \
     ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
 tiffdump)
   _arguments \
-    '-o[set initial TIFF directory (file offset)]:file offset:' \
+    '-o+[set initial TIFF directory (file offset)]:file offset' \
     '-h[print numbers in hexadecimal]' \
+    '-m+[change number of indirect items printed]:items [24]' \
     '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
 tiffinfo)
-  _arguments \
+  _arguments -s \
     '-c[display colormap and color/gray response curves]' \
     '-D[read and decompress data]' \
     '-d[print decompressed data]' \
     '-j[display JPEG-related tags]' \
-    '-o[set initial TIFF directory (file offset)]:file offset' \
+    '-o+[set initial TIFF directory (file offset)]:file offset' \
+    '-r[read/display raw image data instead of decoded data]' \
     '-s[display offsets and byte counts for all data strips]' \
     '-i[ignore read errors]' \
-    '-f[force fill order]:fill order:(lsb2msb msb2lsb)' \
+    '-f+[force fill order]:fill order:(lsb2msb msb2lsb)' \
     '-w[display raw data in words]' \
+    '-z[enable strip chopping]' \
     '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
 tiffmedian)
   _arguments -C \
-    '-r[specify rows per strip]:rows per strip' \
-    '-C[specify number of colormap entries]:number of colormap entries' \
-    '-c[specify compression scheme]:compression scheme:->compress' \
+    '-r+[specify rows per strip]:rows per strip' \
+    '-C+[specify number of colormap entries]:number of colormap entries' \
+    '-c+[specify compression scheme]:compression scheme:->compress' \
     '-f[use Floyd-Steinberg dithering]' \
     ':input file:_files -g "*.(#i)tif(|f)(-.)"' \
     ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
@@ -117,52 +173,57 @@ tiffsplit)
     ':output file prefix' && ret=0
   ;;
 fax2tiff)
-  _arguments \
+  _arguments -s \
+    '!(-1 -2 -3 -4)-'{1,3} \
     '(-1 -4)-2[input is Group 3, 2d encoded]' \
-    '(-2 -4)-1[input is Group 3, 1d encoded]' \
-    '(-1 -2)-4[input is Group 4 encoded]' \
-    '(-W)-B[0 in input is black]' \
-    '(-B)-W[0 in input is white]' \
-    '(-M)-L[input is lsb-to-msb]' \
-    '(-L)-M[input is msb-to-lsb]' \
-    '-R[specify resolution]:resolution (lines per inch)' \
-    '-o[specify output file]:output file:_files -g "*.(#i)tif(|f)(-.)"' \
-    '(-f)-c[generate `classic'"'"' TIFF format]' \
-    '(-c)-f[generate TIFF Class F format]' \
+    '(-1 -2 -A)-4[input is Group 4 encoded]' \
+    '-U[input is uncompressed]' \
+    '(-4)-A[input is EOL-aligned]' \
+    '-B[0 in input means black]' \
+    '-M[input is msb-to-lsb]' \
+    '-R+[specify resolution]:resolution (lines per inch) [196]' \
+    '-X+[specify input data width]:width [1728]' \
+    '-o+[specify output file]:output file:_files -g "*.(#i)tif(|f)(-.)"' \
+    '(-5 -p)-8[generate G4-encoded output]' \
+    '-u[generate uncompressed output]' \
+    '(-8)-5[generate 1d encoded output]' \
+    "(-8)-p[don't align EOL codes]" \
+    '-c[generate `classic'"'"' TIFF format]' \
     '-m[output in msb-to-lsb order]' \
-    "-p[don't align EOL codes]" \
-    '-s[duplicate all rows]' \
+    '-r+[specify rows per strip]:rows per strip' \
+    '-s[stretch image by duplicating all rows]' \
     '-v[verbose mode]' \
+    '-z[generate LZW compressed output]' \
     ':FAX input file:_files -g "*.(#i)(g[34]|fax)(-.)"' && ret=0
   ;;
 gif2tiff)
   _arguments -C \
-    '-r[specify rows per strip]:rows per strip' \
-    '-c[specify compression scheme]:compression scheme:->compress' \
+    '-r+[specify rows per strip]:rows per strip' \
+    '-c+[specify compression scheme]:compression scheme:->compress' \
     ':input GIF file:_files -g "*.(#i)gif(-.)"' \
     ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
 ppm2tiff)
   _arguments -C \
-    '-r[specify rows per strip]:rows per strip' \
-    '-c[specify compression scheme]:compression scheme:->compress' \
-    '-R[specify resolution]:resolution:' \
+    '-r+[specify rows per strip]:rows per strip' \
+    '-c+[specify compression scheme]:compression scheme:->compress' \
+    '-R+[specify resolution]:resolution (dots/inch)' \
     ':input GIF file:_files -g "*.(#i)ppm(-.)"' \
     ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
 ras2tiff)
   _arguments -C \
-    '-r[specify rows per strip]:rows per strip' \
-    '-c[specify compression scheme]:compression scheme:->compress' \
+    '-r+[specify rows per strip]:rows per strip' \
+    '-c+[specify compression scheme]:compression scheme:->compress' \
     ':input raster image file:_files -g "*.(#i)ras(|t)(-.)"' \
     ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
 pal2rgb)
   _arguments -C \
-    '-C[specify number of bits for colormap entries]:bits for colormap entries:(8 16)' \
-    '-p[set sample packing]:sample packing:(contig separate)' \
-    '-c[specify compression scheme]:compression scheme:->compress' \
-    '-r[specify rows per strip]:rows per strip' \
+    '-C+[specify number of bits for colormap entries]:bits for colormap entries:(8 16)' \
+    '-p+[set sample packing]:sample packing:(contig separate)' \
+    '-c+[specify compression scheme]:compression scheme:->compress' \
+    '-r+[specify rows per strip]:rows per strip' \
     ':input file:_files -g "*.(#i)tif(|f)(-.)"' \
     ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0
   ;;
@@ -179,7 +240,7 @@ if [[ -n "$state" ]]; then
 
     case "$scheme" in
     g3)
-      _values -s : 'FAX Group 3 options' \
+      _values -s : 'FAX Group 3 option' \
         '(2d)1d[use 1D-encoding]' \
         '(1d)2d[use 2D-encoding]' \
 	'fill[byte-align EOL codes]' && ret=0
@@ -188,8 +249,8 @@ if [[ -n "$state" ]]; then
       _message -e values "compression quality (0-100), or \`r' (output RGB)"
       ret=0
       ;;
-    lzw|zip)
-      _values 'LZW and deflate options' \
+    lzw|lzma|zip)
+      _values 'LZW and deflate option' \
         '1[without differencing]' \
         '2[with differencing]' && ret=0
       ;;
@@ -198,8 +259,8 @@ if [[ -n "$state" ]]; then
     _tags values
     while _tags; do
       while _next_label values expl 'compression scheme'; do
-        compadd "$expl[@]" - none g4 packbits && ret=0
-        compadd "$expl[@]" -qS: - lzw zip jpeg g3 && ret=0
+        compadd "$expl[@]" - none jbig g4 packbits sgilog && ret=0
+        compadd "$expl[@]" -qS: - lzw zip lzma jpeg g3 && ret=0
       done
       (( ret )) || return 0
     done



Messages sorted by: Reverse Date, Date, Thread, Author