2009-05-17 22:14:02 +02:00
|
|
|
# bash completion for cdrecord/wodim
|
|
|
|
|
2009-06-08 21:22:43 +03:00
|
|
|
have cdrecord || have wodim &&
|
2009-05-17 22:14:02 +02:00
|
|
|
_cdrecord()
|
|
|
|
{
|
2010-01-03 18:13:31 +01:00
|
|
|
local cur prev i generic_options track_options track_mode split=false
|
2009-05-17 22:14:02 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2009-05-17 22:14:02 +02:00
|
|
|
|
2010-01-03 18:13:31 +01:00
|
|
|
_split_longopt && split=true
|
|
|
|
|
|
|
|
case $prev in
|
|
|
|
textfile|cuefile)
|
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
blank)
|
|
|
|
COMPREPLY=( $( compgen -W 'help all fast \
|
|
|
|
track unreserve trtail unclose session' \
|
|
|
|
-- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
driveropts)
|
|
|
|
COMPREPLY=( $( compgen -W 'burnfree noburnfree\
|
|
|
|
varirec= audiomaster forcespeed noforcespeed\
|
|
|
|
speedread nospeedread singlesession \
|
|
|
|
nosinglesession hidecdr nohidecdr tattooinfo\
|
|
|
|
tattoofile=' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
$split && return 0
|
2009-05-17 22:14:02 +02:00
|
|
|
|
2009-10-18 22:12:37 +03:00
|
|
|
generic_options=(-version -v -V -d -silent -force -immed -dummy \
|
2009-10-04 19:42:50 +02:00
|
|
|
-dao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc \
|
|
|
|
-atip -fix -nofix -waiti -load -lock -eject -format \
|
|
|
|
-setdropts -checkdrive -prcap -inq -scanbus -reset \
|
|
|
|
-abort -overburn -ignsize -useinfo -packet -noclose \
|
|
|
|
-text debug= kdebug= kd= minbuf= speed= blank= fs= \
|
|
|
|
dev= gracetime= timeout= driver= driveropts= \
|
|
|
|
defpregap= pktsize= mcn= textfile= cuefile=)
|
|
|
|
track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \
|
|
|
|
-isosize -pad padsize= -nopad -shorttrack -noshorttrack\
|
|
|
|
pregap= -preemp -nopreemp -copy -nocopy -scms tcsize= \
|
|
|
|
isrc= index=)
|
|
|
|
# look if previous was either a file or a track option
|
|
|
|
track_mode=0
|
|
|
|
if [ $COMP_CWORD -gt 1 ]; then
|
|
|
|
if [ -f "$prev" ]; then
|
|
|
|
track_mode=1
|
|
|
|
else
|
|
|
|
for (( i=0; i < ${#track_options[@]}; i++ )); do
|
|
|
|
if [[ "${track_options[i]}" == "$prev" ]]; then
|
|
|
|
track_mode=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
2009-05-17 22:14:02 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
# files are always eligible completion
|
|
|
|
_filedir
|
|
|
|
# track options are always available
|
|
|
|
COMPREPLY=( "${COMPREPLY[@]}" \
|
|
|
|
$( compgen -W '${track_options[@]}' -- "$cur" ) )
|
|
|
|
# general options are no more available after file or track option
|
|
|
|
if [ $track_mode -eq 0 ]; then
|
|
|
|
COMPREPLY=( "${COMPREPLY[@]}" \
|
|
|
|
$( compgen -W '${generic_options[@]}' -- "$cur" ) )
|
|
|
|
fi
|
2009-05-17 22:14:02 +02:00
|
|
|
|
|
|
|
} &&
|
2009-10-22 12:04:29 +03:00
|
|
|
complete -F _cdrecord -o filenames cdrecord wodim
|
2009-10-01 20:54:51 +03:00
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
2009-10-04 19:42:50 +02:00
|
|
|
# sh-basic-offset: 4
|
2009-10-01 20:54:51 +03:00
|
|
|
# sh-indent-comment: t
|
2009-10-04 19:42:50 +02:00
|
|
|
# indent-tabs-mode: nil
|
2009-10-01 20:54:51 +03:00
|
|
|
# End:
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|