[Bash-completion-commits] [bash-completion] 01/01: zopfli: New completion.

Ville Skyttä scop-guest at alioth.debian.org
Fri Aug 23 10:43:12 UTC 2013


This is an automated email from the git hooks/post-receive script.

scop-guest pushed a commit to branch master
in repository bash-completion.

commit 2da4ee9ad5a9016e4e4a89e4822bf6e1688c6175
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Aug 23 13:42:22 2013 +0300

    zopfli: New completion.
---
 completions/Makefile.am         |    3 ++-
 completions/zopfli              |   31 +++++++++++++++++++++++++++++++
 test/completion/zopfli.exp      |    1 +
 test/lib/completions/zopfli.exp |   18 ++++++++++++++++++
 4 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/completions/Makefile.am b/completions/Makefile.am
index 1b01eb2..69f0e2c 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -378,7 +378,8 @@ bashcomp_DATA = 2to3 \
 		xz \
 		xzdec \
 		ypmatch \
-		yum-arch
+		yum-arch \
+		zopfli
 
 EXTRA_DIST = $(bashcomp_DATA) \
 	     _mock _modules _nmcli _subversion _udevadm _yum _yum-utils
diff --git a/completions/zopfli b/completions/zopfli
new file mode 100644
index 0000000..24edc14
--- /dev/null
+++ b/completions/zopfli
@@ -0,0 +1,31 @@
+# bash completion for zopfli                               -*- shell-script -*-
+
+_zopfli()
+{
+    local cur prev words cword
+    _init_completion || return
+
+    case $prev in
+        -h)
+            return
+            ;;
+    esac
+
+    if [[ "$cur" == -* ]]; then
+        COMPREPLY=( $( compgen -W \
+            '$( _parse_help "$1" -h | sed -e "s/#$//" )' -- "$cur" ) )
+        [[ $COMPREPLY == --i ]] && compopt -o nospace
+        return
+    fi
+
+    local IFS=$'\n' xspec="*.@(gz|t[ag]z)"
+
+    _expand || return 0
+
+    compopt -o filenames
+    COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+        $( compgen -d -- "$cur" ) )
+} &&
+complete -F _zopfli zopfli
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/zopfli.exp b/test/completion/zopfli.exp
new file mode 100644
index 0000000..086f78c
--- /dev/null
+++ b/test/completion/zopfli.exp
@@ -0,0 +1 @@
+assert_source_completions zopfli
diff --git a/test/lib/completions/zopfli.exp b/test/lib/completions/zopfli.exp
new file mode 100644
index 0000000..15738ff
--- /dev/null
+++ b/test/lib/completions/zopfli.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+    save_env
+}
+
+
+proc teardown {} {
+    assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "zopfli "
+sync_after_int
+
+
+teardown

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git



More information about the Bash-completion-commits mailing list