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

PATCH: new _xloadimage



New completion for xloadimage/xli. xli is based on an older version of
xloadimage so they have a fair amount in common.

This also factors out completion of X visuals to a separate function.

Oliver

Index: Completion/X/Command/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/.distfiles,v
retrieving revision 1.3
diff -u -r1.3 .distfiles
--- Completion/X/Command/.distfiles	2001/12/11 20:09:55	1.3
+++ Completion/X/Command/.distfiles	2002/01/02 14:38:10
@@ -2,5 +2,5 @@
 .distfiles
 _gv        _netscape  _xauth     _xfig      _xrdb      _xterm     _xwit
 _nedit     _vnc       _x_utils   _xdvi      _xmodmap   _xset      _xv
-_mozilla
+_mozilla   _xloadimage
 '
Index: Completion/X/Command/_netscape
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_netscape,v
retrieving revision 1.2
diff -u -r1.2 _netscape
--- Completion/X/Command/_netscape	2001/12/12 11:29:36	1.2
+++ Completion/X/Command/_netscape	2002/01/02 14:38:10
@@ -7,7 +7,7 @@
   '-xrm:resource:_x_resource' \
   '-help[show usage message]' \
   '-version[show the version number and build date]' \
-  '-visual[use a specific server visual]:id-or-number:' \
+  '-visual[use a specific server visual]:visual:_x_visual -b' \
   '-install[install a private colormap]' \
   '-no-install[use the default colormap]' \
   '-ncols[max no. of colors to allocate for images]:n:' \
Index: Completion/X/Command/_x_utils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_x_utils,v
retrieving revision 1.1
diff -u -r1.1 _x_utils
--- Completion/X/Command/_x_utils	2001/04/02 12:17:06	1.1
+++ Completion/X/Command/_x_utils	2002/01/02 14:38:10
@@ -138,7 +138,7 @@
     '-in:input file:_files -g \*.\(\#i\)xwd' \
     '-plane:image plane to display:' \
     '-std:standard colormap:(best default gray red blue green)' \
-    '-vis:visual class:(StaticGray GrayScale StaticColor PseudoColor DirectColor TrueColor)'
+    '-vis:visual:_x_visual'
   ;;
 xrdb)
   _x_arguments \
Index: Completion/X/Command/_xfig
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_xfig,v
retrieving revision 1.1
diff -u -r1.1 _xfig
--- Completion/X/Command/_xfig	2001/04/02 12:15:15	1.1
+++ Completion/X/Command/_xfig	2002/01/02 14:38:10
@@ -29,6 +29,6 @@
   '-starttextstep:text step:' \
   '-userscale:scale factor:' \
   '-userunit:unit string:' \
-  '-visual:visual:(TrueColor StaticColor DirectColor StaticGray GrayScale PseudoColor)' \
+  '-visual:visual:_x_visual' \
   '-zoom:zoom scale:' \
   '*:xfig file:_files -g \*.\(\#i\)\(\|x\)fig'
Index: Completion/X/Command/_xloadimage
===================================================================
RCS file: _xloadimage
diff -N _xloadimage
--- /dev/null	Thu May 24 22:33:05 2001
+++ _xloadimage	Wed Jan  2 06:38:10 2002
@@ -0,0 +1,85 @@
+#compdef xli xloadimage xsetbg xview
+
+local rc ipath extension filter type args
+
+if rc=( ${(f)"$($words[1] -path)"} ); then
+  # xli
+  filter=( .Z )
+  args=(
+    '-cache[force caching of entire input]'
+    "-delete[enable deleting images with 'x' key]"
+    '-dispgamma[specify gamma correction]'
+    '-fillscreen[use whole screen, zooming image]'
+    '-focus[take keyboard focus]'
+    '-path[display image path and suffixes]'
+    -dumpcore
+    '*-iscale[scale image]:scale factor'
+    '*-c'{,olor}'dither[dither image]'
+    '*-expand[expand image to 24-bit]'
+    '*-xpm[specify xpm color map]:color context key:(m g4 g c)'
+  )
+else
+  # xloadimage
+  rc=( ${(f)"$($words[1] -configuration)"} )
+  filter=( ${${(Q)rc[4,-1]%% -*}# } )
+  type=( ${(f)"$($words[1] -supported)"} )
+  args=(
+    '-configuration[display image path, suffixes and filters]'
+    '-dump[dump image into file]:image type:( '${(F)${(M)type:#*Yes*}%% *}' ):filename:_files'
+    -slideshow
+    '*-type[force type of image]:type name:( '${(F)type[3,-1]%% *}' )'
+    '*-shrink[shrink image to fit display]'
+    '*-tile[tile image to fill display]'
+    '*-global[following option applies to all images]'
+  )
+fi
+ipath=( . ${=rc[1]#*:} )
+extension=( ${=rc[2]#*:} )
+
+# all options are valid after -help so no exclusion lists below
+_x_arguments "$args[@]" \
+  '-default[set root background to default]' \
+  '-fit[use default visual and colormap]' \
+  '-fullscreen[use whole screen, suurounding image with border]' \
+  "-goto[specify image to display at end]:image name:_files -W ipath -g '*(#i)(${(j:|:)extension})(|${(j:|:)filters})'" \
+  '(*)-help[display information on options]' \
+  '-identity[identify supplied images instead of displaying]' \
+  '-install[forcibly install image colormap on focus]' \
+  '-list[list images]' \
+  '-onroot[display to root window]' \
+  '-path[display image path and suffixes]' \
+  '-pixmap[force the use of a pixmap as backing-store]' \
+  '-private[force use of a private colormap]' \
+  '-quiet[quiet operation]' \
+  '-supported[list supported image types]' \
+  '-verbose[verbose operation]' \
+  '-version[display version info]' \
+  '-view[view image in window]' \
+  '-visual[force use of a specific visual]:visual:_x_visual' \
+  '-windowid[set background pixmap of specific window]:window id:_x_window' \
+  -fork -debug \
+  '*-border[specify background color]:background color:_x_color' \
+  '*-brighten[brighten/darken image]:percentage multiplier' \
+  '*-colors[specify maximum colors in image]:colors' \
+  '*-delay[delay before advancing to next image]:seconds' \
+  '*-dither[dither color image to mono]' \
+  '*-gamma[specify gamma of display image was intended for]:gamma' \
+  '*-gr'{a,e}'y[convert image to grayscale]' \
+  '*-idelay[specify delay for this image]' \
+  '*-smooth[smooth a color image]' \
+  '*-xzoom[zoom X axis of image]:percentage' \
+  '*-yzoon[zoom Y axis of image]:percentage' \
+  '*-zoom:percentage' \
+  '*-newoptions[reset options]' \
+  '*-at[specify coordinates to load next image at]' \
+  '*-background[specify background color for next image]:color:_x_color' \
+  '*-center[center next image on base image]' \
+  '*-clip:X,Y,W,H' \
+  '*-foreground[specify foreground color for next image]:color:_x_color' \
+  '*-halftone[force halftone dithering]' \
+  '*-invert[invert a monochrome image]' \
+  '*-merge[merge image onto the base image]' \
+  "*-name[specify image name]:picture file:_files -W ipath -g '*(#i)(${(j:|:)extension})(|${(j:|:)filters})'" \
+  '*-normalize' \
+  '*-rotate[rotate image clockwise]:degrees of rotation:(90 180 270)' \
+  "*:picture file:_files -W ipath -g '*(#i)(${(j:|:)extension})(|${(j:|:)filter})'"
Index: Completion/X/Command/_xv
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_xv,v
retrieving revision 1.1
diff -u -r1.1 _xv
--- Completion/X/Command/_xv	2001/04/02 12:16:36	1.1
+++ Completion/X/Command/_xv	2002/01/02 14:38:10
@@ -29,7 +29,7 @@
   '-white:'"'"'white'"'"' color:_x_color' \
   '-black:'"'"'black'"'"' color:_x_color' \
   '-wait:seconds to wait:' \
-  '-visual:visual:(TrueColor StaticColor DirectColor StaticGray GrayScale PseudoColor)' \
+  '-visual:visual:_x_visual' \
   '-cursor:cursor character number:' \
   '-icgeometry:icon geometry:_x_geometry' \
   '-dir:directory:_files -/' \
Index: Completion/X/Type/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Type/.distfiles,v
retrieving revision 1.1
diff -u -r1.1 .distfiles
--- Completion/X/Type/.distfiles	2001/04/02 12:43:51	1.1
+++ Completion/X/Type/.distfiles	2002/01/02 14:38:10
@@ -5,5 +5,5 @@
 _x_colormapid         _x_keysym             _x_title
 _x_cursor             _x_locale             _x_window
 _x_display            _x_modifier           _xt_session_id
-_x_extension          _x_name
+_x_extension          _x_name               _x_visual
 '
Index: Completion/X/Type/_x_visual
===================================================================
RCS file: _x_visual
diff -N _x_visual
--- /dev/null	Thu May 24 22:33:05 2001
+++ _x_visual	Wed Jan  2 06:38:10 2002
@@ -0,0 +1,8 @@
+#autoload
+
+# with the -b option, include `Best' in the matches
+local best="${argv[(r)-b]:+Best}"
+argv[(i)-b]=()
+
+_wanted visuals expl visual compadd "$@" -M 'm:{a-zA-Z}={A-Za-z}' - \
+    $best DirectColor TrueColor PseudoColor StaticColor GrayScale StaticGray

This email has been scanned for all viruses by the MessageLabs SkyScan service. For more information on a pro-active anti-virus service working around the clock, around the globe visit http://www.messagelabs.com/



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