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

PATCH: completion updates



A few updates:
  _modutils - now finds modules on 2.6. Some options have changed
              for 2.6 too but I've haven't touched those
  _lzop     - uses braces where descriptions are identical
  _perldoc  - complete all options
  _vorbis   - update for latest version (complete .flac files)
  _mozilla  - firebird has been renamed again
  _nedit    - update for new options in NEdit 5.4

Oliver

Index: Completion/Linux/Command/_modutils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/Command/_modutils,v
retrieving revision 1.3
diff -u -r1.3 _modutils
--- Completion/Linux/Command/_modutils	25 Jun 2003 09:03:06 -0000	1.3
+++ Completion/Linux/Command/_modutils	13 Feb 2004 15:14:03 -0000
@@ -67,8 +67,8 @@
   ;;
 
   all_modules)
-    modules=( ${${(M)${(f)"$(_call_program modules ${(M)words[1]##*/}modprobe -c 2>/dev/null)"}:#path*}#*[=]} )
-    _wanted modules expl module compadd ${^modules}/**/*.o(:t:r) && return
+    modules=( ${${${${(f)"$(_call_program modules ${(M)words[1]##*/}modprobe -l 2>/dev/null)"}:#}##*/}%.*} )
+    _wanted modules expl module compadd -a modules && return
   ;;
 
   params)
Index: Completion/Unix/Command/_lzop
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_lzop,v
retrieving revision 1.4
diff -u -r1.4 _lzop
--- Completion/Unix/Command/_lzop	21 Jan 2004 13:53:29 -0000	1.4
+++ Completion/Unix/Command/_lzop	13 Feb 2004 15:14:03 -0000
@@ -4,42 +4,23 @@
 typeset -A opt_args
 
 _arguments -C -s \
-  '(--to-stdout --stdout)-c[write on standard output]' \
-  '(-c --stdout)--to-stdout[write on standard output]' \
-  '(-c --to-stdout)--stdout[write on standard output]' \
-  '(--decompress --uncompress -x -extract)-d[decompress]' \
-  '(-d --uncompress -x -extract)--decompress[decompress]' \
-  '(-d --decompress -x -extract)--uncompress[decompress]' \
-  '(--extract -d --decompress --uncompress -n --name -p --path)-x[extract]' \
-  '(-x -d --decompress --uncompress -n --name -p --path)-x[extract]' \
-  '(--force)-f[force overwrite]' \
-  '(-f)--force[force overwrite]' \
-  '(--help -H)-h[display help message]' \
-  '(-h -H)--help[display help message]' \
-  '(-h --help)-H[display help message]' \
-  '(--list)-l[list compressed file contents]' \
-  '(-l)--list[list compressed file contents]' \
-  '(--license)-L[display software license]' \
-  '(-L)--license[display software license]' \
-  '(--no-name -N --name)-n[do not save or restore the original name and time stamp]' \
-  '(-n -N --name)--no-name[do not save or restore the original name and time stamp]' \
-  '(--name -n --no-name)-N[save or restore the original name and time stamp]' \
-  '(-N -n --no-name)--name[save or restore the original name and time stamp]' \
+  '(-c --stdout --to-stdout)'{-c,--stdout,--to-stdout}'[write on standard output]' \
+  '(-d --decompress --uncompress -x -extract)'{-d,--decompress,--uncompress}'[decompress]' \
+  '(-x --extract -d --decompress --uncompress -n --name -p --path)'{-x,--extract}'[extract]' \
+  '(-f --force)'{-f,--force}'[force overwrite]' \
+  '(- *)'{-h,-H,--help}'[display help information]' \
+  '(-l --list)'{-l,--list}'[list compressed file contents]' \
+  '(-L --license)'{-L,--license}'[display software license]' \
+  '(-n --no-name -N --name)'{-n,--no-name}'[do not save or restore the original name and time stamp]' \
+  '(-N --name -n --no-name)'{-N,--name}'[save or restore the original name and time stamp]' \
   '--no-mode[do not restore original mode]' \
   '--no-time[do not restore original time stamp]' \
-  '(--quiet --silent)-q[suppress all warnings]' \
-  '(-q --silent)--quiet[suppress all warnings]' \
-  '(-q --quiet)--silent[suppress all warnings]' \
-  '(--recursive)-r[operate recursively on directories]' \
-  '(-r)--recursive[operate recursively on directories]' \
-  '(--suffix)-S+[specify suffix for compressed files]:suffix:' \
-  '(-S)--suffix=[specify suffix for compressed files]:suffix:' \
-  '(--test)-t[test compressed file integrity]' \
-  '(-t)--test[test compressed file integrity]' \
-  '*-v[verbose mode]' \
-  '*--verbose[verbose mode]' \
-  '(--version)-V[display version number]' \
-  '(-V)--version[display version number]' \
+  '(-q --quiet --silent)'{-q,--quiet,--silent}'[suppress all warnings]' \
+  '(-r --recursive)'{-r,--recursive}'[operate recursively on directories]' \
+  '(-S --suffix)'{-S+,--suffix=}'[specify suffix for compressed files]:suffix' \
+  '(-t --test)'{-t,--test}'[test compressed file integrity]' \
+  \*{-v,--verbose}'[verbose mode]' \
+  '(- *)'{-V,--version}'[display version number]' \
   '(       -1 -2 -3 -4 -5 -6 -7 -8 -9 --best)--fast' \
   '(--fast    -2 -3 -4 -5 -6 -7 -8 -9 --best)-1' \
   '(--fast -1    -3 -4 -5 -6 -7 -8 -9 --best)-2' \
@@ -53,19 +34,12 @@
   '(--fast -1 -2 -3 -4 -5 -6 -7 -8 -9       )--best' \
   '--ls=[list each compressed file in a format similar to ls -ln]:ls flag:->flags' \
   '--info[list internal header fields for each compressed file]' \
-  '(--sysinfo)-I[display information about the system]' \
-  '(-I)--sysinfo[display information about the system]' \
-  '(--outfile)-o[specify output file]:output file:_files' \
-  '(-o)--outfile=[specify output file]:output file:_files' \
-  '(--path)-p[write output files to specified directory]:directory:_files -/' \
-  '(-p)--path=[write output files to specified directory]:directory:_files -/' \
-  '(--no-checksum)-F[do not store or verify a checksum]' \
-  '(-F)--no-checksum[do not store or verify a checksum]' \
-  "(--keep -U --unlink --delete)-k[keep (don't delete) input files]" \
-  "(-k -U --unlink --delete)--keep[keep (don't delete) input files]" \
-  '(--unlink --delete)-U[delete input files]' \
-  '(-U --delete)--unlink[delete input files]' \
-  '(-U --unlink)--delete[delete input files]' \
+  '(-I --sysinfo)'{-I,--sysinfo}'[display information about the system]' \
+  '(-o --outfile)'{-o,--outfile=}'[specify output file]:output file:_files' \
+  '(-p --path)'{-p,--path=}'[write output files to specified directory]:directory:_files -/' \
+  '(-F --no-checksum)'{-F,--no-checksum}'[do not store or verify a checksum]' \
+  '(-k --keep -U --unlink --delete)'{-k,--keep}"[keep (don't delete) input files]" \
+  '(-U --unlink --delete)'{-U,--unlink,--delete}'[delete input files]' \
   '--no-stdin[do not try to read stdin]' \
   '--no-warn[suppress all warnings]' \
   '--ignore-warn[suppress all warnings and never exit with status 2]' \
@@ -86,15 +60,14 @@
       _files "$expl[@]" -g '*.[tl]zo(-.)' && ret=0
     else
       _description files expl 'file to compress'
-      _files "$expl[@]" -g '*~*.[tl]zo(-.)' && ret=0
-
+      _files "$expl[@]" -g '^*.[tl]zo(-.)' && ret=0
     fi
   ;;
   flags)
     zstyle -s ":completion:${curcontext}:flags" list-separator sep || sep=--
-    disp=( \
-      "F $sep Append a \`*' for executable files" \
-      "G $sep Inhibit display of group information" \
+    disp=(
+      "F $sep Append a \`*' for executable files"
+      "G $sep Inhibit display of group information"
       "Q $sep Enclose file names in double quotes" )
     disp=( ${disp[@]:#[Z$PREFIX]*} )
     compset -P '[FGQ]*'
Index: Completion/Unix/Command/_perldoc
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_perldoc,v
retrieving revision 1.2
diff -u -r1.2 _perldoc
--- Completion/Unix/Command/_perldoc	21 Jan 2004 13:53:29 -0000	1.2
+++ Completion/Unix/Command/_perldoc	13 Feb 2004 15:14:03 -0000
@@ -1,23 +1,59 @@
-#compdef perldoc
-#
-# _perldoc - zsh completion function for perldoc
-#
-# Adam Spiers <adam@xxxxxxxxxx>
-#
-
-_perldoc () {
-  _arguments -s \
-    '-h:help:' \
-    '(-q)-f:Perl built-in function:_perl_builtin_funcs:*:' \
-    '(-f)-q:Perl FAQ keyword:' \
-    '*:Perl pod pages:_perl_pods'
-}
-
-_perl_pods () {
-  _alternative \
-    'modules:: _perl_modules' \
-    'pods:: _perl_basepods' \
-    'files:Perl modules and .pods:_files -g "*.(pod|pm)(-.)"'
-}
+#compdef perldoc -value-,PERLDOC,-default-
 
-_perldoc "$@"
+local curcontext="$curcontext" state line expl args ret=1
+typeset -A opt_args
+
+args=( '*:Perl pod pages:->perl-pods' )
+
+if [[ $service = *PERLDOC* ]]; then
+  compset -q
+  words=( fake "$words[@]" )
+  (( CURRENT++ ))
+  args=()
+fi
+
+_arguments -C -s -S -A "-*" \
+  '(- *)-h[print help information]' \
+  '(- *)-V[display version information]' \
+  '-v[verbose output]' \
+  '-t[use plain text output instead of nroff]' \
+  '-u[show raw Pod source]' \
+  '*-m[display entire module]:module:_perl_modules' \
+  '-l[display only filename of the module found]' \
+  '-F[consider arguments as filenames]' \
+  '(-q)-f+[view documentation for Perl built-in function]:perl builtin function:->perl-builtin-funcs' \
+  '(-f)-q+[search question headings in Perl FAQ]:regular expression' \
+  '(-d)-T[send output direct to stdout and not via pager]' \
+  '(-T)-d+[specify output file]:output file:_files' \
+  '-o+[specify output format]:output format:(man nroff pod rtf text tk xml latex)' \
+  '-M[specifies module to use for formatting]:module:_perl_modules' \
+  '-w[specify option to formatter]:option' \
+  '-X[use an index if present]' \
+  '-n+[specify replacement for nroff]:nroff replacement:_command_names -e' \
+  '-r[recursive search]' \
+  '-i[ignore case]' \
+  "$args[@]" && ret=0
+
+case  $state in
+  perl-builtin-funcs)
+    : ${(A)_perl_builtin_funcs:=${(u)${${(M)${(f)"$(_call_program functions \
+	perldoc -u perlfunc 2>/dev/null)"}:#\=item [a-z]*}#* }%%[^a-z]*}}
+
+    _wanted functions expl 'perl built-in function' compadd "$@" -a - \
+	_perl_builtin_funcs && ret=0
+  ;;
+
+  perl-pods)
+    if (( $+opt_args[-F] )); then
+      _wanted files expl 'Perl modules and .pods' \
+          _files -g "*.(pod|pm)(-.)" && ret=0
+    else
+      _alternative \
+	'modules:: _perl_modules' \
+	'pods:: _perl_basepods' \
+	'files:Perl modules and .pods:_files -g "*.(pod|pm)(-.)"' && ret=0
+    fi
+  ;;
+esac
+
+return ret
Index: Completion/Unix/Command/_vorbis
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_vorbis,v
retrieving revision 1.3
diff -u -r1.3 _vorbis
--- Completion/Unix/Command/_vorbis	21 Jan 2004 13:53:29 -0000	1.3
+++ Completion/Unix/Command/_vorbis	13 Feb 2004 15:14:03 -0000
@@ -5,8 +5,9 @@
 case $service in
   oggenc)
     _arguments -s \
-      '(-)'{-h,--help}'[show help]' \
-      '(-r --raw)'{-r,--raw}'[assume input data is raw little-endian audio data with no header information]' \
+      '(- *)'{-h,--help}'[show help]' \
+      '(- *)'{-v,--version}'[display version information]' \
+      '(-r --raw)'{-r,--raw}'[assume input data is raw, little-endian with no header information]' \
       '(-B --raw-bits)'{-B,--raw-bits=}'[set raw mode input sample size in bits]:sample size:(8 16)' \
       '(-C --raw-chan)'{-C,--raw-chan=}'[set raw mode input number of channels]:number of channels' \
       '(-R --raw-rate)'{-R,--raw-rate=}'[set raw mode input sample rate]:sample rate:(44100 48000)' \
@@ -21,8 +22,11 @@
       '--downmix[down mix input from stereo to mono]' \
       '--advanced-encode-option:option name:_values option "bitrate_average_window[set the managed bitrate window]\:number (seconds)" "lowpass_frequency[set the lowpass frequency]\:frequency (kHz)"' \
       '(-s --serial)'{-s,--serial}'[force a specific serial number in the output stream]' \
-      '(-o --output-file)'{-o,--output-file=}'[write the Ogg Vorbis stream to output_file]:files:->oggfiles' \
-      '(-n --pattern)'{-n,--pattern=}'[specify pattern for producing filenames]:string' \
+      "--discard-comments[don't copy comments from FLAC file to output Ogg Vorbis file]" \
+      '(-o --output)'{-o,--output=}'[write the Ogg Vorbis stream to output_file]:files:->oggfiles' \
+      '(-n --names)'{-n,--names=}'[specify pattern for producing filenames]:string' \
+      '(-X --name-remove)'{-X,--name-remove=}'[remove specified characters from output filenames]:characters' \
+      '(-P --name-replace)'{-P,--name-replace=}'[specify replacement characters for those removed]:characters' \
       '(-c --comment)'{-c,--comment}'[add the string comment as an extra comment]:comment' \
       '(-a --artist)'{-a,--artist}'[set the artist comment field in the comments to artist]:artist' \
       '(-G --genre)'{-G,--genre}'[set the genre comment field in the comments to genre]:genre' \
@@ -30,62 +34,57 @@
       '(-N --tracknum)'{-N,--tracknum}'[set the track number comment field to the given value]:track number' \
       '(-t --title)'{-t,--title}'[set the track title comment field to title]:title' \
       '(-l --album)'{-l,--album}'[set the album comment field to album]' \
-      '*:wav file:_files -g "(#i)*.wav(-.)"' && ret=0
+      '*:input file:_files -g "(#i)*.(flac|wav|aiff)(-.)"' && ret=0
   ;;
   ogg123)
     _arguments -C -s \
-      '(-h --help)'{-h,--help}'[show help]' \
-      '(-)'{-V,--version}'[display version information]' \
-      '(-d --device)'{-d,--device}'[output device]:device:((null\:discard\ all\ data oss\:open\ sound\ system sun\:sun\ audio alsa\:advanced\ linux\ sound\ architecture irix\:IRIX\ audio arts\:aRts\ sound\ daemon esd\:enlightened\ sound\ daemon au\:sun\ audio\ file raw\:raw\ sample wav\:wav\ file))' \
-      '(-f --files)'{-f,--files=}'[output filename for a previously specified file device]:output filename:_files' \
-      '(-k --skip)'{-k,--skip}'[skip the first '\''n'\'' seconds]:seconds' \
+      '(- *)'{-h,--help}'[show help]' \
+      '(- *)'{-V,--version}'[display version information]' \
+      \*{-d,--device}'[output device]:device:((null\:discard\ all\ data oss\:open\ sound\ system sun\:sun\ audio alsa\:advanced\ linux\ sound\ architecture irix\:IRIX\ audio arts\:aRts\ sound\ daemon esd\:enlightened\ sound\ daemon au\:sun\ audio\ file raw\:raw\ sample wav\:wav\ file))' \
+      \*{-f,--files=}'[output filename for a previously specified file device]:output filename:_files -g "(#i)*.(wav|au|raw)(-.)"' \
+      '(-k --skip)'{-k,--skip}"[skip the first 'n' seconds (or to hh:mm:ss)]:seconds" \
+      '(-K --end)'{-K,--end}"[end at 'n' seconds (or hh:mm:ss)]:seconds" \
       '(-b --buffer)'{-b,--buffer}'[size of input buffer]:kilobytes' \
       '(-p --prebuffer)'{-p,--prebuffer}'[prebuffer percentage]:percent' \
-      '(-q --quiet)'{*-v,*--verbose}'[increase verbosity]' \
+      '(-q --quiet)*'{-v,--verbose}'[increase verbosity]' \
       '(-q --quiet -v --verbose)'{--quiet,-q}'[quiet mode]' \
       '(-x --nth)'{-x,--nth}'[block decode intervall]:number' \
       '(-y --ntimes)'{-y,--ntimes}'[block repeat count]:number' \
       '(-z --shuffle)'{-z,--shuffle}'[shuffle play]' \
-      '(-l --delay)'{-l,--delay=}'[set delay]:delay (ms)' \
-      '(-@ --playlist)'{-@,--playlist}'[play all of  the  files from a playlist]:playlist:_files' \
+      '(-l --delay)'{-l,--delay=}'[set delay between two SIGINTs to quit]:delay (ms)' \
+      '(-@ --list)'{-@,--list}'[play all of  the  files from a playlist]:playlist:_files' \
       '--audio-buffer[size of output audio buffer]:kilobytes' \
-      {'*-o','*--device-option='}'[assign device option values]:device option:->devopts' \
-      '*:files:->oggfiles' && ret=0
+      \*{-o,--device-option=}'[assign device option values]:device option:->devopts' \
+      '*:sound file or directory:_files -g "(#i)*.(ogg|flac)"' && ret=0
   ;;
   ogginfo)
-    _arguments -C -s \
-      '-h[show a help and usage message]' \
-      '*-q[quiet  mode]' \
-      '-v[verbose mode]' \
-      '*:files:->oggfiles' && ret=0
+    _arguments \
+      '(- *)-h[show a help and usage message]' \
+      '(-)*-q[quiet  mode]' \
+      '(-)-v[verbose mode]' \
+      '*:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' && ret=0
   ;;
   oggdec)
-    _arguments -C -s \
+    _arguments -s \
       '(-q --quiet)'{-q,--quiet}'[quiet mode]' \
-      '(-)'{-h,--help}'[print help information]' \
-      '(-)'{-v,--version}'[display version information]' \
+      '(- *)'{-h,--help}'[print help information]' \
+      '(- *)'{-v,--version}'[display version information]' \
       '(-b --bits)'{-b,--bits=}'[bits per sample]:bits per sample:(8 16)' \
       '(-e --endian)'{-e,--endian=}'[set endianness for 16-bit output]:endianness:((0\:\(default\)\ little-endian\ \(Intel\ byte\ order\) 1\:big-endian\ \(sane\ byte\ order\)))' \
       '(-R --raw)'{-R,--raw=}'[output in raw format]' \
       '(-o --output)'{-o,--output=}'[write output to specified filename]:output filename:_files' \
       '(-s --sign)'{-s,--sign=}'[set signedness for output]:signedness:((0\:unsigned 1\:signed\ \(default\)))' \
-      '*:files:->oggfiles' && ret=0
+      '*:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' && ret=0
   ;;
 esac
 
-case $state in
-  oggfiles)
-    _wanted files expl 'ogg vorbis file' \
-	_files "$expl[@]" -g '(#i)*.ogg(-.)' && return
-  ;;
-  devopts)
-    if compset -p '*:'; then
-      _message -e value value
-    else
-      _wanted devopts expl 'device option' \
-	  compadd -S : - dsp dev card buf_size host byteorder && return
-    fi
-  ;;
-esac
+if [[ $state = devopts ]]; then
+  if compset -p '*:'; then
+    _message -e value value
+  else
+    _wanted devopts expl 'device option' \
+	compadd -S : - dsp dev card buf_size host byteorder && return
+  fi
+fi
 
 return ret
Index: Completion/X/Command/_mozilla
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_mozilla,v
retrieving revision 1.3
diff -u -r1.3 _mozilla
--- Completion/X/Command/_mozilla	21 Nov 2003 20:29:52 -0000	1.3
+++ Completion/X/Command/_mozilla	13 Feb 2004 15:14:03 -0000
@@ -1,4 +1,4 @@
-#compdef mozilla mozilla-firebird mozilla-xremote-client
+#compdef mozilla mozilla-firefox mozilla-xremote-client
 
 local curcontext="$curcontext" state line ret=1 suf
 typeset -A opt_args
Index: Completion/X/Command/_nedit
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_nedit,v
retrieving revision 1.3
diff -u -r1.3 _nedit
--- Completion/X/Command/_nedit	19 Aug 2002 14:51:59 -0000	1.3
+++ Completion/X/Command/_nedit	13 Feb 2004 15:14:03 -0000
@@ -10,20 +10,22 @@
   '-do[execute macro or action commands]:macro command'
   '-lm[specify language mode]:language mode:->lang'
   '-svrname[name the server]:nedit server name'
-  '(-noiconic)-iconic[set initial window state to iconic]'
+  '(-noiconic -icon -iconic)'{-icon,-iconic}'[set initial window state to iconic]'
   '(- *)'{-V,-version}'[display version information]'
   '*-xrm:resource:_x_resource'
   '*:file:_files'
 )
 
 if [[ $service = nc ]]; then
-  _x_arguments -C \
+  _x_arguments -C -S \
     '(-noask)-ask[prompt if no server found]' \
     '(-ask)-noask[start a new server without asking if none found]' \
+    "-wait[don't return to the shell until all files given are closed]" \
+    '-timeout[timeout period when talking to server]:timeout (seconds)' \
     '-svrcmd[command to run server]:server command:_command_names -e' \
     "$nedit_common[@]" && ret=0
 else
-  _x_arguments -C \
+  _x_arguments -C -S \
     '-server[designate this session as an nedit server]' \
     '-tags[load ctags file]:tags file:_files' \
     '-tabs[specify tab width in characters]:tab width' \



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