[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 48027cfbe1ba73eb1dbc6aa05ae7b5737873d390

Ville Skyttä ville.skytta at iki.fi
Mon Jun 21 20:48:27 UTC 2010


The following commit has been merged in the master branch:
commit 48027cfbe1ba73eb1dbc6aa05ae7b5737873d390
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Mon Jun 21 23:48:18 2010 +0300

    Add lr(un)zip completion.

diff --git a/CHANGES b/CHANGES
index ac9ced7..4e9595f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,7 +5,7 @@ bash-completion (2.x)
 
   [ Ville Skyttä ]
   * Activate hping2 completion also for hping and hping3.
-  * Add crontab completion.
+  * Add crontab and lrzip completions.
   * Add gif to mplayer filename completions (Alioth: #312512).
   * Add "short" tarball extensions to unxz, unlzma etc completions.
 
diff --git a/Makefile.am b/Makefile.am
index d34b028..f83171e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -75,6 +75,7 @@ bashcomp_DATA = contrib/abook \
 		contrib/links \
 		contrib/lintian \
 		contrib/lisp \
+		contrib/lrzip \
 		contrib/lvm \
 		contrib/lzma \
 		contrib/lzop \
diff --git a/bash_completion b/bash_completion
index 4c18406..2f60404 100644
--- a/bash_completion
+++ b/bash_completion
@@ -78,6 +78,7 @@ complete -f -X '!*.Z' uncompress
 # lzcmp, lzdiff intentionally not here, see Debian: #455510
 complete -f -X '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
 complete -f -X '!*.@(?(t)xz|tlz|lzma)' unxz xzcat
+complete -f -X '!*.lrz' lrunzip
 complete -f -X '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' ee
 complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|GIF|JPG|JP?(E)G|TIF?(F)|PNG|P[BGP]M|BMP|X[BP]M|RLE|RGB|PCX|FITS|PM)' xv qiv
 complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview
diff --git a/contrib/lrzip b/contrib/lrzip
new file mode 100644
index 0000000..e584803
--- /dev/null
+++ b/contrib/lrzip
@@ -0,0 +1,63 @@
+# lrzip(1) completion
+
+have lrzip &&
+_lrzip()
+{
+    COMPREPLY=()
+    local cur prev
+    _get_comp_words_by_ref cur prev
+
+    if [[ "$cur" == -* && $prev != -N ]]; then
+        COMPREPLY=( $( compgen -W '-w -d -o -O -S -f -D -q -L -n -l -b -g -M \
+            -T -N -v -vv -V -h' -- "$cur" ) )
+        return 0
+    fi
+
+    local xspec="*.lrz"
+
+    case $prev in
+        -w|-S|-V|-h)
+            return 0
+            ;;
+        -d)
+            xspec="!"$xspec
+            ;;
+        -o)
+            _filedir
+            return 0
+            ;;
+        -O)
+            _filedir -d
+            return 0
+            ;;
+        -L)
+            COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+            return 0
+            ;;
+        -T)
+            COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
+            return 0
+            ;;
+        -N)
+            COMPREPLY=( $( compgen -W '-20 -19 -18 -17 -16 -15 -14 -13 -12 \
+                -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 \
+                12 13 14 15 16 17 18 19' -- "$cur" ) )
+            return 0
+            ;;
+    esac
+
+    _expand || return 0
+
+    local IFS=$'\t\n'
+    COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+        $( compgen -d -- "$cur" ) )
+} &&
+complete -F _lrzip -o filenames lrzip
+
+# 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/lrzip.exp b/test/completion/lrzip.exp
new file mode 100644
index 0000000..60616f0
--- /dev/null
+++ b/test/completion/lrzip.exp
@@ -0,0 +1 @@
+assert_source_completions lrzip
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/lrzip.exp
similarity index 66%
copy from test/lib/completions/abook.exp
copy to test/lib/completions/lrzip.exp
index 43f6272..bcf26c1 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/lrzip.exp
@@ -1,17 +1,17 @@
 proc setup {} {
     save_env
-}
+}; # setup()
 
 
 proc teardown {} {
     assert_env_unmodified
-}
+}; # teardown()
 
 
 setup
 
 
-assert_complete_any "abook "
+assert_complete_any "lrzip "
 
 
 sync_after_int

-- 
bash-completion



More information about the Bash-completion-commits mailing list