18893, 18901: new completions for rar/unrar and ogg vorbis; improve _pkgtool

This commit is contained in:
Oliver Kiddle 2003-07-24 11:52:58 +00:00
parent f863b49206
commit adf2c2a0b6
4 changed files with 244 additions and 1 deletions

View file

@ -1,5 +1,12 @@
2003-07-24 Oliver Kiddle <opk@zsh.org>
* 18901: baptiste daroussin (and Nikolai Weibull, 18894):
Completion/Unix/Command/_vorbis: new completions for ogg vorbis
* 18893: baptiste daroussin: Completion/Linux/Command/_pkgtool,
Completion/Unix/Command/_rar: improved _pkgtool and new
completions for rar/unrar
* 18900: Completion/Linux/Command/_iptables,
Completion/Unix/Command/_nmap: new iptables and nmap completions

View file

@ -73,7 +73,7 @@ _slackware_pkg() {
'-tagfile[this flag is used to specify from the command line which tagfile should be used for the installation.]:tagfile:_files -/'
'-source_dir[used when installing multiple packages from disk sets. This is the directory in which the subdirectories for each disk are found.]:source directory:_path_files -/'
'-target_dir[the directory where the target root directory is located. This is '/' when installing on the hard drive, or typically '\''/mnt'\'' when installing from an install disk.]:target directory:_path_files -W -/'
'-source_device[the source device to install from. This is not used if you'\''ve provided the -source_mounted flag. It'\''s usually used when installing from floppy.]:source device:_files -/'
'-source_device[the source device to install from. This is not used if you'\''ve provided the -source_mounted flag. It'\''s usually used when installing from floppy.]:source device:{compadd "$expl[@]" /dev/*}'
)
_arguments -s \
$flags[@]

View file

@ -0,0 +1,137 @@
#compdef rar unrar
_rar(){
case $service in
rar)
_arguments -s \
'*::rar command:_rar_command'
;;
unrar)
_arguments -s \
'*::unrar command:_unrar_command'
;;
esac
}
_compression_level() {
compression_level=
_tags compression_level && { compadd "$@" -k compression_level || compadd "$@" ${(kv)=compression_level} }
}
_dico_size() {
dico_size=(64 128 256 512 1024 2048 4096 a b c d e f g)
_tags dico_size && { compadd "$@" -k dico_size || compadd "$@" ${(kv)=dico_size} }
}
_unrar_command () {
cmd=(e l lt p t v vt x)
if (( CURRENT == 1 ));then
_tags cmd && { compadd "$@" -k cmd || compadd "$@" ${(kv)=cmd} }
else
_arguments -C \
'-ad[Append archive name to destination path]'\
'-ap[Set path inside archive]'\
'-av\-[Disable authenticity verification check]'\
'-c\-[Disable comments show]'\
'-cfg\-[Disable read configuration]'\
'-cl\-[Convert names to lower case]'\
'-cu[Convert names to upper case]'\
'-dh[Open shared files]'\
'-ep[Exclude paths from name]'\
'-f[Freshen files]'\
'-idp[Disable percentage display]'\
'-ierr[Send all messages to stderr]'\
'-inul[Disable all messages]'\
'-kb[Keep broken extracted files]'\
'-o\+[Overwrite existing files]'\
'-o\-[Do not overwrite existing files]'\
'-ow[Save or restore file owner and group]'\
'-p\-[Do not query password]'\
'-r[Recurse subdirectorie]'\
'-ta[Process files modified after <date> in YYYYMMDDHHMMSS format]'\
'-tb[Process files modified before <date> in YYYYMMDDHHMMSS format]'\
'-tn[Process files newer than <time>]'\
'-to[Process files older than <time>]'\
'-u[Update files]'\
'-v[Create volumes with size autodetection or list all volumes]'\
'-ver[File version control]'\
'-vp[Pause before each volume]'\
'-x[Exclude specified file]'\
'-y[Assume Yes on all queries]'\
'*:RAR files:_files -g \*.rar' && return 0
fi
}
_rar_command () {
cmd=(a c cf cw d e f i k l lt m mf p r rc rr rv s t u v vt x)
if (( CURRENT == 1 ));then
_tags cmd && { compadd "$@" -k cmd || compadd "$@" ${(kv)=cmd} }
else
_arguments -s \
'-ad[Append archive name to destination path]'\
'-ag[Generate archive name using the current date]'\
'-ap[Set path inside archive]'\
'-as[Synchronize archive contents]'\
'-av[Put authenticity verification (registered versions only)]'\
'-av\-[Disable authenticity verification check]'\
'-c\-[Disable comments show]'\
'-cfg\-[Disable read configuration]'\
'-cl\-[Convert names to lower case]'\
'-cu[Convert names to upper case]'\
'-df[Delete files after archiving]'\
'-dh[Open shared files]'\
'-ds[Disable name sort for solid archive]'\
'-e[Set file exclude attributes]'\
'-ed[Do not add empty directories]'\
'-en[Do not put end of archive block]'\
'-ep[Exclude paths from name]'\
'-ep1[Exclude base directory from names]'\
'-ep2[Expand paths to full]'\
'-f[Freshen files]'\
'-hp[Encrypt both file data and headers]'\
'-idp[Disable percentage display]'\
'-ierr[Send all messages to stderr]'\
'-ilog[Log errors to file (registered versions only)]'\
'-inul[Disable all messages]'\
'-isnd[Enable sound]'\
'-k[Lock archive]'\
'-kb[Keep broken extracted files]'\
'-m+[Set compression level (0-store...3-default...5-maximal)]:compression level:(( 0\:store 1\:fastest 2\:fast 3\:normal 4\:good 5\:maximal ))'\
'-md+[Dictionary size in KB]:dictionaty size in KB:_dico_size' \
'-ms[Specify file types to store]'\
'-o\+[Overwrite existing files]'\
'-o\-[Do not overwrite existing files]'\
'-ol[Save symbolic links as the link instead of the file]'\
'-ow[Save or restore file owner and group]'\
'-p[Set password]'\
'-p\-[Do not query password]'\
'-r[Recurse subdirectorie]'\
'-r0[Recurse subdirectories for wildcard names only]'\
'-rr[Add data recovery record]'\
'-rv[Create recovery volumes]'\
'-s[Create solid archive]'\
'-se[Create solid archive using extension]'\
'-sv[Create solid archive using volumes]'\
'-s\-[Disable solid archiving]'\
'-sfx[Create SFX archive]'\
'-t[Test files after archiving]'\
'-ta[Process files modified after <date> in YYYYMMDDHHMMSS format]'\
'-tb[Process files modified before <date> in YYYYMMDDHHMMSS format]'\
'-tk[Keep original archive time]'\
'-tl[Set archive time to latest file]'\
'-tn[Process files newer than <time>]'\
'-to[Process files older than <time>]'\
'-u[Update files]'\
'-v[Create volumes with size autodetection or list all volumes]'\
'-ver[File version control]'\
'-vn[Use the old style volume naming scheme]'\
'-vp[Pause before each volume]'\
'-w+[Assign work directory]:work directory:_files -/'\
'-x[Exclude specified file]'\
'-y[Assume Yes on all queries]'\
'-z+[Read archive comment from file]:comment file:_files' \
'*:files:_files'
fi
}
_rar "$@"

View file

@ -0,0 +1,99 @@
#compdef oggenc ogg123 ogginfo oggdec
_advanced_option() {
_values "options name" \
'bitrate_average_window[set the managed bitrate window to NN seconds.]:number:'\
'lowpass_frequency[set the lowpass frequency to NN kHz.]:number:'
}
_vorbis (){
local expl
case $service in
oggenc)
_arguments -C -s \
{'(--help)-h','(-h)--help'}'[show help]'\
{'(--raw)-r','(-r)--raw'}'[assume input data is raw little-endian audio data with no header information.]'\
{'(--raw-bits=)-B','(-B)--raw-bits='}'[sets raw mode input sample size in bits.]:sample size:(8 16)'\
{'(--raw-chan=)-C','(-C)--raw-chan='}'[sets raw mode input number of channels.]:number of channels:'\
{'(--raw-rate=)-R','(-R)--raw-rate='}'[sets raw mode input samplerate.]:samplerate:(44100 48000)'\
'--raw-endianness[sets raw mode endianness]:endianness:(( 0\:big\ endian 1\:little\ endian ))'\
{'(--quiet)-Q','(-Q)--quiet'}'[quiet mode.]'\
{'(--bitrate=)-b','(-b)--bitrate='}'[sets encoding to the bitrate closest to n (in kb/s).]:bitrate in kb/s:'\
{'(--min-bitrate=)-m','(-m)--min-bitrate='}'[sets minimum bitrate to n (in kb/s).]:bitrate in kb/s:'\
{'(--max-bitrate=)-M','(-M)--max-bitrate='}'[sets maximum bitrate to n (in kb/s).]:bitrate in kb/s:'\
'--managed[turn off the normal VBR encoding]'\
{'(--quality=)-q','(-q)--quality='}'[sets encoding quality.]:quality:(0 1 2 3 4 5 6 7 8 9 10)'\
'--resample[resample input to the given sample rate (in Hz) before encoding.]:sample rate:'\
'--downmix[downmix input from stereo to mono.]'\
'--advanced-encode-option[sets an advanced option.]:option name:_advanced_option'\
{'(--serial)-s','(-s)--serial'}'[forces a specific serial number in the output stream.]'\
{'(--output-file=)-o','(-o)--output-file='}'[write the Ogg Vorbis stream to output_file]:files:->oggfiles'\
{'(--pattern=)-n','(-n)--pattern='}'[produce filenames as this string]:string:'\
{'*-c','*--comment'}'[add the string comment as an extra comment.]:comment:'\
{'*-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:'\
{'*-d','*--date'}'[sets the date comment field to the given value.]:date:'\
{'*-N','*--tracknum'}'[sets 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.]'\
'*:files:->wavfiles' && return 0
;;
ogg123)
_arguments -C -s \
{'(-h)--help','(--help)-h'}'[show help]'\
{'(--version)-V','(-V)--version'}'[display version information.]'\
{'(-d)--device','(--device)-d'}'[output device.]:device:((null\:"discards 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"))' \
{'(--files=)-f','(-f)--files='}'[output filename for a previously specified file device.]:output filename:_files'\
{'(--skip)-k','(-k)--skip'}'[skip the first '\''n'\'' seconds.]:seconds:'\
{'(--buffer)-b','(-b)--buffer'}'[size of input buffer.]:kilobytes:'\
{'(--prebuffer)-p','(-p)--prebuffer'}'[prebuffer percentage.]:percent:'\
{'(--quiet -q)*-v','(--quiet -q)*--verbose'}'[increase verbosity.]'\
{'(--verbose -v --quiet)-q','(-q --verbose -v)--quiet'}'[quiet mode.]'\
{'(--nth)-x','(-x)--nth'}'[block decode intervall.]:number:'\
{'(--ntimes)-y','(-y)--ntimes'}'[block repeat count.]:number:'\
{'(--shuffle)-z','(-z)--shuffle'}'[shuffle play.]'\
{'(--delay=)-l','(-l)--delay='}'[set delay in millisecond.]:milliseconds:'\
{'(--playlist)-@','(-@)--playlist'}'[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]:devopts:->devopts'\
'*:files:->oggfiles' && return 0
;;
ogginfo)
_arguments -C -s \
'-h[show a help and usage message]'\
'*-q[quiet mode.]'\
'-v[verbose mode.]'\
'*:files:->oggfiles' && return 0
;;
oggdec)
_arguments -C -s \
{'(--quiet)-q','(-q)--quiet'}'[quiet mode.]'\
{'(--help)-h','(-h)--help'}'[print help message.]'\
{'(--version)-v','(-v)--version'}'[display version information.]'\
{'(--bits=)-b','(-b)--bits='}'[bits per sample.]:bits per sample:(8 16)'\
{'(--endian=)-e','(-e)--endian'}'[set endianness for 16-bit output.]:endianness:(( 0\:\(default\)\ is\ little-endian\ \(Intel\ byte\ order\). 1\:is\ big-endian\ \(sane\ byte\ order\). ))'\
{'(--raw=)-R','(-R)--raw='}'[output in raw format.]'\
{'(--output=)-o','(-o)--output='}'[write output to specified filename.]:output filename:_files'\
{'(--sign=)-s','(-s)--sign='}'[set signedness for output.]:signedness:(( 0\:unsigned 1\:signed\ \(default\) ))'\
'*:files:->oggfiles' && return 0
;;
esac
case $state in
oggfiles)
_description files expl 'ogg vorbis files'
_files "$expl[@]" -g '*.ogg'
;;
wavfiles)
_description files expl 'wav files'
_files "$expl[@]" -g '*.wav'
;;
devopts)
_setup devopts
_tags devopts
_description devopts expl 'device options'
compadd "$expl[@]" -S : - dsp dev card buf_size host byteorder
;;
esac
}
_vorbis "$@"