[Bash-completion-commits] [SCM] bash-completion branch, master, updated. eced7126a30bb62c49924f0b2dc61f0131317c00
Guillaume Rousse
guillomovitch at zarb.org
Sun May 17 20:13:24 UTC 2009
The following commit has been merged in the master branch:
commit eced7126a30bb62c49924f0b2dc61f0131317c00
Author: Guillaume Rousse <guillomovitch at zarb.org>
Date: Sun May 17 22:14:02 2009 +0200
split cdrecord/wodim completion
diff --git a/bash_completion b/bash_completion
index 1590706..40c4f2f 100644
--- a/bash_completion
+++ b/bash_completion
@@ -5864,83 +5864,6 @@ _dict()
complete -F _dict $default dict rdict
}
-# cdrecord(1) completion
-#
-(have cdrecord || have wodim) &&
-_cdrecord()
-{
- local cur prev i generic_options track_options track_mode
-
- COMPREPLY=()
- cur=`_get_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
-
-} &&
-complete -F _cdrecord $filenames cdrecord wodim
-
# CUPS cancel(1) completion
#
have cancel &&
diff --git a/contrib/wodim b/contrib/wodim
new file mode 100644
index 0000000..5cac48a
--- /dev/null
+++ b/contrib/wodim
@@ -0,0 +1,79 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for cdrecord/wodim
+
+(have cdrecord || have wodim) &&
+_cdrecord()
+{
+ local cur prev i generic_options track_options track_mode
+
+ COMPREPLY=()
+ cur=`_get_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
+
+} &&
+complete -F _cdrecord $filenames cdrecord wodim
--
bash-completion
More information about the Bash-completion-commits
mailing list