- cdrecord completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
This commit is contained in:
parent
7a43833338
commit
ed6278bab8
@ -1,6 +1,6 @@
|
|||||||
# bash_completion - some programmable completion functions for bash 2.05b
|
# bash_completion - some programmable completion functions for bash 2.05b
|
||||||
#
|
#
|
||||||
# $Id: bash_completion,v 1.603 2003/08/03 04:02:32 ianmacd Exp $
|
# $Id: bash_completion,v 1.604 2003/08/04 01:36:10 ianmacd Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||||
#
|
#
|
||||||
@ -4900,7 +4900,7 @@ _iconv()
|
|||||||
|
|
||||||
# dict(1) completion
|
# dict(1) completion
|
||||||
#
|
#
|
||||||
{ have dict || have rdict; } &&
|
{ have dict || have rdict; } && {
|
||||||
_dictdata()
|
_dictdata()
|
||||||
{
|
{
|
||||||
dict $host $port $1 2>/dev/null | sed -ne \
|
dict $host $port $1 2>/dev/null | sed -ne \
|
||||||
@ -4968,13 +4968,91 @@ _dict()
|
|||||||
[ -r $dictfile ] && \
|
[ -r $dictfile ] && \
|
||||||
COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
|
||||||
}
|
}
|
||||||
[ -n "${have:-}" ] && complete -F _dict $default dict rdict
|
complete -F _dict $default dict rdict
|
||||||
|
}
|
||||||
|
|
||||||
# A little help for FreeBSD ports users
|
# A little help for FreeBSD ports users
|
||||||
[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list \
|
[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list \
|
||||||
extract patch configure build install reinstall \
|
extract patch configure build install reinstall \
|
||||||
deinstall clean clean-depends kernel buildworld' make
|
deinstall clean clean-depends kernel buildworld' make
|
||||||
|
|
||||||
|
|
||||||
|
# cdrecord(1) completion
|
||||||
|
have cdrecord &&
|
||||||
|
_cdrecord()
|
||||||
|
{
|
||||||
|
local cur prev i generic_options track_options track_mode
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
|
||||||
|
# foo=bar style option
|
||||||
|
if [[ "$cur" == *=* ]]; then
|
||||||
|
prev=${cur/=*/}
|
||||||
|
cur=${cur/*=/}
|
||||||
|
case "$prev" in
|
||||||
|
@(text|cue)file)
|
||||||
|
_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
|
||||||
|
fi
|
||||||
|
|
||||||
|
generic_options=(-version -v -V -d -silent -s -force -immed -dummy \
|
||||||
|
-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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
}
|
||||||
|
[ -n "${have:-}" ] && complete -F _cdrecord cdrecord
|
||||||
|
|
||||||
_filedir_xspec()
|
_filedir_xspec()
|
||||||
{
|
{
|
||||||
local IFS cur xspec
|
local IFS cur xspec
|
||||||
|
Loading…
x
Reference in New Issue
Block a user