2002-02-14 18:56:53 +01:00
|
|
|
#compdef cdcd
|
|
|
|
|
2002-08-09 18:05:43 +02:00
|
|
|
local expl
|
2002-02-14 18:56:53 +01:00
|
|
|
|
|
|
|
_cdcd_tracks ()
|
|
|
|
{
|
2002-08-09 18:05:43 +02:00
|
|
|
local -a tracks
|
|
|
|
tracks=( ${${(M)${(f)"$(cdcd tracks)"}:#(#s) #[0-9]##:*}/(#s) #(#b)([0-9]##):[ >]#? #[^ ]# #(*) ##/$match[1]:${match[2]}} )
|
|
|
|
_describe tracks tracks -V tracks
|
2002-02-14 18:56:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_cdcd_commands ()
|
|
|
|
{
|
2002-08-09 18:05:43 +02:00
|
|
|
local -a commands
|
|
|
|
commands=(
|
|
|
|
'play:play a track'
|
|
|
|
'stop:stop playing'
|
|
|
|
{open,eject}':eject the CD-ROM tray'
|
|
|
|
'close:close the CD-ROM tray'
|
|
|
|
'pause:pause playing'
|
|
|
|
'resume:resume playing'
|
|
|
|
'ff:fast forward'
|
|
|
|
'rew:rewind'
|
|
|
|
'next:advance one track'
|
|
|
|
'prev:return to previous track'
|
|
|
|
'getvol:get current volume settings'
|
|
|
|
'setvol:set volume settings'
|
|
|
|
'status:get numerical data regarding the CD status'
|
|
|
|
'info:short information about the CD'
|
|
|
|
'tracks:list all tracks on the CD'
|
|
|
|
'rndplay:play a random track'
|
|
|
|
'list:list all CDs in a CD-ROM changer'
|
|
|
|
'slot:changes the current CD in the CD-ROM changer'
|
|
|
|
'edit:edit information about the disc'
|
|
|
|
'ext:Extended information about the disc'
|
|
|
|
'refresh:refresh the information about the CD from a CDDB server'
|
|
|
|
'device:change the CD-ROM device cdcd will use'
|
|
|
|
'verbose:toggle verbosity'
|
|
|
|
'sites:edit the server list'
|
|
|
|
'access:configure cddb access method'
|
|
|
|
'help:display a help message'
|
|
|
|
)
|
2003-03-12 19:55:12 +01:00
|
|
|
_describe -t commands 'cdcd command' commands
|
2002-02-14 18:56:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (( CURRENT == 2 )); then
|
|
|
|
_cdcd_commands
|
|
|
|
else
|
2002-08-09 18:05:43 +02:00
|
|
|
case "$words[2]" in
|
2002-02-14 18:56:53 +01:00
|
|
|
# sub-commands with no args
|
|
|
|
stop|open|eject|close|pause|resume|next|prev|getvol)
|
2002-08-09 18:05:43 +02:00
|
|
|
;&
|
2002-02-14 18:56:53 +01:00
|
|
|
status|info|tracks|rndplay|list|slot|refresh)
|
2002-08-09 18:05:43 +02:00
|
|
|
_message 'no more arguments'
|
2002-02-14 18:56:53 +01:00
|
|
|
;;
|
|
|
|
# sub-commands with args that cannot be completed
|
|
|
|
ff|rew|setvol)
|
|
|
|
;;
|
|
|
|
# sub-commands that do not work as expected
|
|
|
|
access|edit|sites)
|
|
|
|
;;
|
|
|
|
# completeable sub-commands
|
|
|
|
verbose)
|
2002-08-09 18:05:43 +02:00
|
|
|
_wanted subcommand expl 'verbose subcommand' compadd on off
|
2002-02-14 18:56:53 +01:00
|
|
|
;;
|
|
|
|
ext)
|
2002-08-09 18:05:43 +02:00
|
|
|
_values 'ext subcommand' \
|
|
|
|
'disc[extra information about the disc]' \
|
|
|
|
{1..${${(z)${${(f)"$(cdcd info)"}[3]}}[3]}}
|
2002-02-14 18:56:53 +01:00
|
|
|
;;
|
|
|
|
device)
|
2002-08-09 18:05:43 +02:00
|
|
|
_wanted device expl 'cdrom device' compadd /dev/cd* /dev/cd*/*
|
2002-02-14 18:56:53 +01:00
|
|
|
;;
|
|
|
|
play)
|
2002-08-09 18:05:43 +02:00
|
|
|
_cdcd_tracks
|
2002-02-14 18:56:53 +01:00
|
|
|
;;
|
|
|
|
help)
|
|
|
|
_cdcd_commands;;
|
|
|
|
esac
|
|
|
|
fi
|