From 8074e07a2ced99c4464d4a72cb93f47a7aacf34b Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 2 Jan 2002 14:45:21 +0000 Subject: 16384: new completion for xli/xloadimage and factor out completion of X visuals --- Completion/X/Command/.distfiles | 2 +- Completion/X/Command/_netscape | 2 +- Completion/X/Command/_x_utils | 2 +- Completion/X/Command/_xfig | 2 +- Completion/X/Command/_xloadimage | 85 ++++++++++++++++++++++++++++++++++++++++ Completion/X/Command/_xv | 2 +- Completion/X/Type/.distfiles | 2 +- Completion/X/Type/_x_visual | 8 ++++ 8 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 Completion/X/Command/_xloadimage create mode 100644 Completion/X/Type/_x_visual (limited to 'Completion/X') diff --git a/Completion/X/Command/.distfiles b/Completion/X/Command/.distfiles index da4d54381..26bf2aff1 100644 --- a/Completion/X/Command/.distfiles +++ b/Completion/X/Command/.distfiles @@ -2,5 +2,5 @@ DISTFILES_SRC=' .distfiles _gv _netscape _xauth _xfig _xrdb _xterm _xwit _nedit _vnc _x_utils _xdvi _xmodmap _xset _xv -_mozilla +_mozilla _xloadimage ' diff --git a/Completion/X/Command/_netscape b/Completion/X/Command/_netscape index be38e0c85..48b3fab7b 100644 --- a/Completion/X/Command/_netscape +++ b/Completion/X/Command/_netscape @@ -7,7 +7,7 @@ _x_arguments -C \ '-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:' \ diff --git a/Completion/X/Command/_x_utils b/Completion/X/Command/_x_utils index 89e5b3bc1..e286dd3b3 100644 --- a/Completion/X/Command/_x_utils +++ b/Completion/X/Command/_x_utils @@ -138,7 +138,7 @@ xwud) '-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 \ diff --git a/Completion/X/Command/_xfig b/Completion/X/Command/_xfig index e5c950e45..8ea3f4a6c 100644 --- a/Completion/X/Command/_xfig +++ b/Completion/X/Command/_xfig @@ -29,6 +29,6 @@ _x_arguments \ '-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' diff --git a/Completion/X/Command/_xloadimage b/Completion/X/Command/_xloadimage new file mode 100644 index 000000000..8a3712673 --- /dev/null +++ b/Completion/X/Command/_xloadimage @@ -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})'" diff --git a/Completion/X/Command/_xv b/Completion/X/Command/_xv index 832374267..1a4523eb6 100644 --- a/Completion/X/Command/_xv +++ b/Completion/X/Command/_xv @@ -29,7 +29,7 @@ _x_arguments \ '-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 -/' \ diff --git a/Completion/X/Type/.distfiles b/Completion/X/Type/.distfiles index b5eb31446..364e4e6e6 100644 --- a/Completion/X/Type/.distfiles +++ b/Completion/X/Type/.distfiles @@ -5,5 +5,5 @@ _x_color _x_geometry _x_selection_timeout _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 ' diff --git a/Completion/X/Type/_x_visual b/Completion/X/Type/_x_visual new file mode 100644 index 000000000..13b42ca6e --- /dev/null +++ b/Completion/X/Type/_x_visual @@ -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 -- cgit 1.4.1