1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-10 12:40:58 +02:00

17522: clean up a few things

This commit is contained in:
Oliver Kiddle 2002-08-09 16:05:43 +00:00
parent e7652ce1e6
commit d2608bb9bd
5 changed files with 60 additions and 85 deletions

View file

@ -1,5 +1,10 @@
2002-08-09 Oliver Kiddle <opk@zsh.org> 2002-08-09 Oliver Kiddle <opk@zsh.org>
* 17522: Completion/Debian/Command/_apt-show-versions,
Completion/Unix/Command/_cdcd, Completion/Unix/Command/_texinfo,
Completion/Unix/Command/_wget, Completion/Unix/Type/_urls:
a few function cleanups and handle tkinfo
* 17521: Completion/Unix/Command/_ant, * 17521: Completion/Unix/Command/_ant,
Completion/Unix/Command/.distfiles: new completion for ant Completion/Unix/Command/.distfiles: new completion for ant

View file

@ -1,21 +1,12 @@
#compdef apt-show-versions #compdef apt-show-versions
_arguments \ _arguments \
'(--status-file)-stf[status file]:status file:_files' \ '(--status-file -stf)'{--status-file=,-stf}'[specify dpkg status file]:status file:_files' \
'(-stf)--status-file=:status file:_files' \ '(--list-dir -ld)'{--list-dir=,-ld}"[specify dir for apt's list files]:apt list dir:_files -/" \
'(--list-dir)-ld[aptlist dir]:aptlist dir:_files -/' \ '(--package -p)'{--package=,-p}'[restrict to specified package]:package:_deb_packages avail' \
'(-ld)--list-dir=:aptlist dir:_files -/' \ '(--regex -r)'{--regex,-r}'[interpret -p argument as regex]' \
'(--package)-p[package]:package:_deb_packages avail' \ '(--upgradeable -u)'{--upgradeable,-u}'[print only upgradeable packages]' \
'(-p)--package=:package:_deb_packages avail' \ '(--allversions -a)'{--allversions,-a}'[print all available versions]' \
'(--regex)-r[regex]' \ '(--brief -b)'{--brief,-b}'[brief output]' \
'(-r)--regex' \ '(--verbose -v)'{--verbose,-v}'[verbose output]' \
'(--upgradeable)-u[print only upgradeable packages]' \ '(--help -h)'{--help,-h}'[display help information]'
'(-u)--upgradeable' \
'(--allversions)-a[print all available versions]' \
'(-a)--allversions' \
'(--brief)-b[brief output]' \
'(-b)--brief' \
'(--verbose)-v[verbose output]' \
'(-v)--verbose' \
'(--help)-h[help]' \
'(-h)--help'

View file

@ -1,66 +1,57 @@
#compdef cdcd #compdef cdcd
typeset -A opt_args local expl
_cdcd_tracks () _cdcd_tracks ()
{ {
print ${${${(f)"$(cdcd info)"}[3]}/Total tracks: #(#b)([0-9]##)*/$match[1]} local -a tracks
} tracks=( ${${(M)${(f)"$(cdcd tracks)"}:#(#s) #[0-9]##:*}/(#s) #(#b)([0-9]##):[ >]#? #[^ ]# #(*) ##/$match[1]:${match[2]}} )
_describe tracks tracks -V tracks
_cdcd_track_list ()
{
print ${1..$(_cdcd_tracks)}
}
_cdcd_track_list_verbose ()
{
print ${${(M)${(f)"$(cdcd tracks)"}:#(#s) #[0-9]##:*}/(#s) #(#b)([0-9]##):[ >]#? #[^ ]# #(*) ##/$match[1]:${(qqq)match[2]}}
} }
_cdcd_commands () _cdcd_commands ()
{ {
_arguments \ local -a commands
':cdcd command:(( commands=(
play\:"play a track" 'play:play a track'
stop\:"stop plating" 'stop:stop playing'
open\:"eject the CD-ROM tray" {open,eject}':eject the CD-ROM tray'
eject\:"eject the CD-ROM tray" 'close:close the CD-ROM tray'
close\:"close the CD-ROM tray" 'pause:pause playing'
pause\:"pause playing" 'resume:resume playing'
resume\:"resume playing" 'ff:fast forward'
ff\:"fast forward" 'rew:rewind'
rew\:"rewind" 'next:advance one track'
next\:"advance one track" 'prev:return to previous track'
prev\:"return to previous track" 'getvol:get current volume settings'
getvol\:"get current volume settings" 'setvol:set volume settings'
setvol\:"set volume settings" 'status:get numerical data regarding the CD status'
status\:"get numerical data regarding the CD status" 'info:short information about the CD'
info\:"short information about the CD" 'tracks:list all tracks on the CD'
tracks\:"list all tracks on the CD" 'rndplay:play a random track'
rndplay\:"play a random track" 'list:list all CDs in a CD-ROM changer'
list\:"list all CDs in a CD-ROM changer" 'slot:changes the current CD in the CD-ROM changer'
slot\:"changes the current CD in the CD-ROM changer" 'edit:edit information about the disc'
edit\:"edit information about the disc" 'ext:Extended information about the disc'
ext\:"Extended information about the disc" 'refresh:refresh the information about the CD from a CDDB server'
refresh\:"refresh the information about the CD from a CDDB server" 'device:change the CD-ROM device cdcd will use'
device\:"change the CD-ROM device cdcd will use" 'verbose:toggle verbosity'
verbose\:"toggle verbosity" 'sites:edit the server list'
sites\:"edit the server list" 'access:configure cddb access method'
access\:"configure cddb access method" 'help:display a help message'
help\:"display a help message" )
))' _describe 'cdcd command' commands
} }
if (( CURRENT == 2 )); then if (( CURRENT == 2 )); then
_cdcd_commands _cdcd_commands
else else
shift words case "$words[2]" in
(( --CURRENT ))
case "$words[1]" in
# sub-commands with no args # sub-commands with no args
stop|open|eject|close|pause|resume|next|prev|getvol) stop|open|eject|close|pause|resume|next|prev|getvol)
;; ;&
status|info|tracks|rndplay|list|slot|refresh) status|info|tracks|rndplay|list|slot|refresh)
_message 'no more arguments'
;; ;;
# sub-commands with args that cannot be completed # sub-commands with args that cannot be completed
ff|rew|setvol) ff|rew|setvol)
@ -70,30 +61,18 @@ else
;; ;;
# completeable sub-commands # completeable sub-commands
verbose) verbose)
_arguments \ _wanted subcommand expl 'verbose subcommand' compadd on off
':verbose subcommand:((
on\:"turn verbosity on"
off\:"turn verbosity off"))'
;; ;;
ext) ext)
_arguments \ _values 'ext subcommand' \
":ext subcommand:(( 'disc[extra information about the disc]' \
disc\:\"extra information about the disc\" {1..${${(z)${${(f)"$(cdcd info)"}[3]}}[3]}}
$(_cdcd_track_list)))"
;; ;;
device) device)
compadd "$expl[@]" /dev/cd* /dev/cd*/* _wanted device expl 'cdrom device' compadd /dev/cd* /dev/cd*/*
;; ;;
play) play)
if (( CURRENT == 2 )); then _cdcd_tracks
_arguments ":play subcommand:((
$(_cdcd_track_list_verbose)))"
else
shift words
(( --CURRENT ))
_arguments ":play subcommand2:((
$(_cdcd_track_list_verbose)))"
fi
;; ;;
help) help)
_cdcd_commands;; _cdcd_commands;;

View file

@ -61,7 +61,7 @@ _arguments -C -s \
'--exclude-domains=:rejected domains:' \ '--exclude-domains=:rejected domains:' \
'--follow-ftp' \ '--follow-ftp' \
'--follow-tags=:HTML tags:' \ '--follow-tags=:HTML tags:' \
'(--ignore-tags -G)'{--ignore-tags=,-G+}'[spcify ignored HTML tags]:HTML tags' \ '(--ignore-tags -G)'{--ignore-tags=,-G+}'[specify ignored HTML tags]:HTML tags' \
'(--span-hosts -H)'{--span-hosts,-H}'[span hosts]' \ '(--span-hosts -H)'{--span-hosts,-H}'[span hosts]' \
'(--relative -L)'{--relative,-L}'[follow relative links only]' \ '(--relative -L)'{--relative,-L}'[follow relative links only]' \
'(--include-directories -I)'{--include-directories=,-I+}'[include directories]:allowed directories' \ '(--include-directories -I)'{--include-directories=,-I+}'[include directories]:allowed directories' \

View file

@ -1,4 +1,4 @@
#compdef curl #compdef curl -value-,http_proxy,-default-
# Configuration styles used: # Configuration styles used:
# #
@ -82,7 +82,7 @@ case "$scheme" in
fi fi
;; ;;
file) file)
[[ -prefix //localhost/ ]] && compset -P //localhost [[ -prefix //(127.0.0.1|localhost)/ ]] && compset -P //(127.0.0.1|localhost)
[[ -prefix /// ]] && compset -P // [[ -prefix /// ]] && compset -P //
if ! compset -P //; then if ! compset -P //; then
_tags -C file files _tags -C file files