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

PATCH: update vorbis-tools completions



This updates completions for vorbis-tools.

Until now, we've had a separate function for vorbiscomment but it is all
part of the same vorbis-tools so is now handled in _vorbis alongside the
other tools. I wrote that completely from scratch without reference to
the old function so it isn't necessary to preserve the comment at the
top of _vorbiscomment. It had its own licence which in some cases adds
extra work for people trying to package zsh.

Oliver

diff --git a/Completion/Unix/Command/_vorbis b/Completion/Unix/Command/_vorbis
index cb3e3f9d8..6c94469f9 100644
--- a/Completion/Unix/Command/_vorbis
+++ b/Completion/Unix/Command/_vorbis
@@ -1,90 +1,148 @@
-#compdef oggenc ogg123 ogginfo oggdec
+#compdef oggenc ogg123 ogginfo oggdec vorbiscomment
 
-local expl ret=1
+local curcontext="$curcontext" ret=1
+local -a alts expl state line suf
 
 case $service in
   oggenc)
-    _arguments -s \
-      '(- *)'{-h,--help}'[show help]' \
-      '(- *)'{-v,--version}'[display version information]' \
+    _arguments -C -s -S \
+      '(-Q --quiet)'{-Q,--quiet}'[produce no output to stderr]' \
+      '(- *)'{-h,--help}'[display usage information]' \
+      '(- *)'{-V,--version}'[display version information]' \
+      '(-k --skeleton)'{-k,--skeleton}'[add an Ogg Skeleton bitstream]' \
       '(-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)' \
-      '--raw-endianness[set raw mode endianness]:endianness:((0\:big\ endian 1\:little\ endian))' \
-      '(-Q --quiet)'{-Q,--quiet}'[quiet mode]' \
+      '(-B --raw-bits)'{-B+,--raw-bits=}'[set raw mode input sample size in bits]:sample size [16]:(8 16)' \
+      '(-C --raw-chan)'{-C+,--raw-chan=}'[set raw mode input number of channels]:number of channels [2]' \
+      '(-R --raw-rate)'{-R+,--raw-rate=}'[set raw mode input sample rate]:sample rate [44100]:(44100 48000)' \
+      '--raw-endianness=[set raw mode endianness]:endianness [0]:((0\:big\ endian 1\:little\ endian))' \
       '(-b --bitrate)'{-b+,--bitrate=}'[set encoding to the bitrate closest to that specified]:bitrate (kb/s)' \
+      '--managed[enable the bitrate management engine]' \
       '(-m --min-bitrate)'{-m+,--min-bitrate=}'[set minimum bitrate]:bitrate (kb/s)' \
       '(-M --max-bitrate)'{-M+,--max-bitrate=}'[set maximum bitrate]:bitrate (kb/s)' \
-      '--managed[turn off the normal VBR encoding]' \
+      '*--advanced-encode-option=:option name:_values option
+        "lowpass_frequency[set the lowpass frequency]\:frequency (kHz)"
+        "impulse_noisetune[set a noise floor bias]\:bias (-15..0)"
+        "bitrate_hard_max[set the allowed bitrate maximum for the encoded file]\:bitrate (kb/s)"
+        "bitrate_hard_min[set the allowed bitrate minimum for the encoded file]\:bitrate (kb/s)"
+        "bit_reservoir_bits[set the total size of the bit reservoir]\:bits"
+        "bit_reservoir_bias[set the behavior bias of the bit reservoir]\:bias (0..1)"
+        "bitrate_average[set the average bitrate for the file]\:bitrate (kb/s)"
+        "bitrate_average_damping[set the reaction time for the average bitrate tracker]\:time (seconds)"
+        "disable_coupling[disable use of channel coupling for multichannel encoding]"' \
       '(-q --quality)'{-q+,--quality=}'[set encoding quality]:quality:(0 1 2 3 4 5 6 7 8 9 10)' \
-      '--resample[resample input to the given sample rate before encoding]:sample rate (Hz)' \
+      '--resample=[resample input to the given sample rate before encoding]:sample rate (Hz)' \
       '--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]' \
+      '--scale=[set input scaling factor]:scaling factor' \
+      '(-s --serial)'{-s+,--serial=}'[force a specific serial number in the output stream]:serial number' \
       "--discard-comments[don't copy comments from FLAC file to output Ogg Vorbis file]" \
+      '--ignorelength[ignore the datalength in Wave headers]' \
       '(-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' \
-      '(-d --date)'{-d+,--date}'[set the date comment field to the given value]:date' \
-      '(-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]' \
+      '--utf8[interpret command-line parameters as already being UTF-8 encoded]' \
+      \*{-c+,--comment=}'[add the string comment as an extra comment]:comment' \
+      \*{-d+,--date=}'[set the date comment field to the given value]:date' \
+      \*{-N+,--tracknum=}'[set the track number comment field to the given value]:track number' \
+      \*{-t+,--title=}'[set the track title comment field to title]:title' \
+      \*{-l+,--album=}'[set the album comment field to album]:album' \
+      \*{-a+,--artist=}'[set the artist comment field in the comments to artist]:artist' \
+      \*{-G+,--genre=}'[set the genre comment field in the comments to genre]:genre' \
+      \*{-L+,--lyrics=}'[include lyrics from specified file]:lyrics file:_files -g "*.(srt|lrc)(-.)"' \
+      \*{-Y+,--lyrics-language=}'[specify language for the lyrics]:language' \
       '*:input file:_files -g "(#i)*.(flac|wav|aiff)(-.)"' && ret=0
   ;;
   ogg123)
-    _arguments -C -s \
-      '(- *)'{-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))' \
+    _arguments -C -s -S \
+      \*{-d+,--device=}'[output device]:device:(aixs alsa arts au esd irix macosx nas null oss pulse raw roar sndio sun wav wmm)' \
       \*{-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)'{--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 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' \
+      '--audio-buffer=[specify size of output audio buffer]:size (kilobytes)' \
       \*{-o,--device-option=}'[assign device option values]:device option:->devopts' \
-      '*:sound file or directory:_files -g "(#i)*.(ogg|flac|spx)"' && ret=0
+      '(-@ --list)'{-@+,--list=}'[play all of the files from a playlist]:playlist:_files' \
+      '(-r --repeat)'{-r,--repeat}'[repeat playlist indefinitely]' \
+      '(-R --remote)'{-R,--remote}'[use remote control interface]' \
+      '(-z --shuffle -Z --random)'{-z,--shuffle}'[shuffle list of files before playing]' \
+      '(-Z --random -z --shuffle -r --repeat)'{-Z,--random}'[play files randomly until interrupted]' \
+      '(-b --buffer)'{-b+,--buffer=}'[specify size of input buffer (HTTP only)]:size (kilobytes)' \
+      '(-p --prebuffer)'{-p+,--prebuffer=}'[delay playback until proportion of buffer filled (HTTP only)]:percent' \
+      '(-k --skip)'{-k+,--skip=}"[skip up to specified time]:start time ([[hh\:]mm\:]ss[.d])" \
+      '(-K --end)'{-K+,--end=}"[end after specified time]:end time ([[hh\:]mm\:]ss[.d])" \
+      '(-x --nth)'{-x+,--nth=}"[play every 'n'th block]:number"\
+      '(-y --ntimes)'{-y+,--ntimes=}"[repeat every 'n'th block]:number" \
+      '(-l --delay)'{-l+,--delay=}'[set delay between two SIGINTs to quit]:delay (ms)' \
+      '(- *)'{-h,--help}'[display usage information]' \
+      '(-q --quiet -v --verbose)'{--quiet,-q}'[quiet mode]' \
+      '(-q --quiet)*'{-v,--verbose}'[increase verbosity]' \
+      '(- *)'{-V,--version}'[display version information]' \
+      \*{-c-,--config=-}'[specify config options]: :_values option
+        "default_device\:device"
+        "shuffle\:value\:(0 1)"
+        "repeat\:value\:(0 1)"' \
+      '*:sound file or directory:->urls-or-files' && ret=0
   ;;
   ogginfo)
-    _arguments \
-      '(- *)-h[show a help and usage message]' \
+    _arguments -S \
+      '(- *)-h[display usage information]' \
+      '(- *)-V[display version information]' \
       '(-)*-q[quiet mode]' \
       '(-)-v[verbose mode]' \
-      '*:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' && ret=0
+      '(-h)*:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' && ret=0
   ;;
   oggdec)
-    _arguments -s \
+    _arguments -s -S \
       '(-Q --quiet)'{-Q,--quiet}'[quiet mode]' \
-      '(- *)'{-h,--help}'[print help information]' \
-      '(- *)'{-v,--version}'[display version information]' \
+      '(- *)'{-h,--help}'[display usage 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]' \
+      '(-e --endianness)'{-e+,--endianness=}'[set endianness for 16-bit output]:endianness [0]:((0\:little-endian\ \(Intel\ byte\ order\) 1\:big-endian\ \(sane\ byte\ order\)))' \
+      '(-s --sign)'{-s+,--sign=}'[set signedness for output]:signedness [1]:((0\:unsigned 1\:signed))' \
+      '(-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\)))' \
       '*:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' && ret=0
   ;;
+  vorbiscomment)
+    _arguments -s -S \
+      '(-l --list)*'{-t+,--tag=}'[specify a comment tag on the commandline]:tag=value' \
+      '(-c --commentfile)'{-c+,--commentfile=}'[specify comment file]:file:_files' \
+      '(-R --raw)'{-R,--raw}'[read and write comments in UTF-8]' \
+      '(-e --escapes)'{-e,--escapes}'[use \\n-style escapes to allow multiline comments]' \
+      '1:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' \
+      '(-l --list)2:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' \
+      + '(actions)' \
+      '(2 -t --tag)'{-l,--list}'[list the comments (default)]' \
+      {-a,--append}'[append comments]' \
+      {-w,--write}'[write comments, replacing the existing ones]' \
+      '(-)'{-h,--help}'[display usage information]' \
+      '(-)'{-V,--version}'[display version information]' && ret=0
+  ;;
 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
+if [[ -n $state ]]; then
+  case $state in
+    urls-or-files)
+      if [[ -prefix 1 (f|ht)tp(|s):// ]]; then
+        alts=( 'urls:URL of sound file:_urls -f -g "*.(#i)(ogg|flax|spx)(-.)"' )
+      else
+        alts=( 'urls:URL of sound file:compadd -S "" ftp:// http:// https://' )
+      fi
+      _alternative \
+        'files:sound file or directory:_files -g "(#i)*.(ogg|flac|spx)"' \
+        $alts && ret=0
+    ;;
+    devopts)
+      if compset -P 1 '*:'; then
+        _message -e value value
+      else
+        _description device-options expl 'device option'
+        if ! compset -S ':*'; then
+          compadd "$expl[@]" - debug verbose quiet && ret=0
+          suf=( -qS : )
+        fi
+        compadd $suf "$expl[@]" - matrix dev buffer_time period_time use_mmap \
+            multi host buf_size dsp server sink byteorder id && ret=0
+      fi
+    ;;
+  esac
 fi
 
 return ret



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