[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 642ef5344f9769fdeb273e496a152b205dd71376

Ville Skyttä ville.skytta at iki.fi
Wed Nov 3 19:14:59 UTC 2010


The following commit has been merged in the master branch:
commit 642ef5344f9769fdeb273e496a152b205dd71376
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Wed Nov 3 21:11:07 2010 +0200

    Add basic growisofs completion.

diff --git a/CHANGES b/CHANGES
index 0b39ca6..47fdab5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,7 +9,7 @@ bash-completion (2.x)
   [ Ville Skyttä ]
   * Activate hping2 completion also for hping and hping3.
   * Add badblocks, compgen, crontab, dumpe2fs, e2freefrag, e2label, ether-wake,
-    filefrag, iftop, ip (Debian: #600617), lrzip, POSIX sh,
+    filefrag, growisofs, iftop, ip (Debian: #600617), lrzip, POSIX sh,
     sha{,224,256,384,512}sum, sysbench, tune2fs, xmodmap, and xrdb completions.
   * Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2,
     *.awb, and *.iso (Alioth: #311420) to mplayer filename completions.
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 5ca478f..51d9eb4 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -35,6 +35,7 @@ bashcomp_DATA = abook \
 		dpkg \
 		dselect \
 		dsniff \
+		dvd+rw-tools \
 		e2fsprogs \
 		findutils \
 		freeciv \
diff --git a/completions/dvd+rw-tools b/completions/dvd+rw-tools
new file mode 100644
index 0000000..f37781e
--- /dev/null
+++ b/completions/dvd+rw-tools
@@ -0,0 +1,47 @@
+# dvd+rw-tools completions
+
+have growisofs &&
+_growisofs()
+{
+    COMPREPLY=()
+    local cur prev
+    _get_comp_words_by_ref cur prev
+
+    case $prev in
+        -version|-speed)
+            return 0
+            ;;
+        -Z|-M)
+            compopt -o nospace &>/dev/null
+            _dvd_devices
+            return 0
+            ;;
+        /?(r)dev/*)
+            if [[ $cur == =* ]] ; then
+                # e.g. /dev/dvd=foo.iso, /dev/dvdrw=/dev/zero
+                cur="${cur#=}"
+                _filedir
+                return 0
+            fi
+            ;;
+    esac
+
+    if [[ "$cur" == -* ]]; then
+        # TODO: mkisofs options
+        COMPREPLY=( $( compgen -W '-dvd-compat -overburn -speed= -Z -M' \
+            -- "$cur" ) )
+        [[ ${COMPREPLY[@]} == *= ]] && compopt -o nospace &>/dev/null
+        return 0
+    fi
+
+    _filedir
+} &&
+complete -F _growisofs growisofs
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/growisofs.exp b/test/completion/growisofs.exp
new file mode 100644
index 0000000..57cb991
--- /dev/null
+++ b/test/completion/growisofs.exp
@@ -0,0 +1 @@
+assert_source_completions growisofs
diff --git a/test/lib/completions/animate.exp b/test/lib/completions/growisofs.exp
similarity index 78%
copy from test/lib/completions/animate.exp
copy to test/lib/completions/growisofs.exp
index 12314d7..0f2a0ec 100644
--- a/test/lib/completions/animate.exp
+++ b/test/lib/completions/growisofs.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "animate "
+assert_complete_any "growisofs "
 
 
 sync_after_int

-- 
bash-completion



More information about the Bash-completion-commits mailing list