[Bash-completion-commits] [bash-completion] 03/03: pngfix: New completion

Ville Skyttä scop-guest at moszumanska.debian.org
Sun Apr 6 10:16:31 UTC 2014


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 13ad1f1966f5baa14d9785c4b732dda3a29f4f14
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Apr 6 13:09:21 2014 +0300

    pngfix: New completion
---
 completions/Makefile.am         |  1 +
 completions/pngfix              | 35 +++++++++++++++++++++++++++++++++++
 test/completion/pngfix.exp      |  1 +
 test/lib/completions/pngfix.exp | 21 +++++++++++++++++++++
 4 files changed, 58 insertions(+)

diff --git a/completions/Makefile.am b/completions/Makefile.am
index b6fe5b3..90b8ebc 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -266,6 +266,7 @@ bashcomp_DATA = 2to3 \
 		pm-hibernate \
 		pm-is-supported \
 		pm-powersave \
+		pngfix \
 		portinstall \
 		portsnap \
 		portupgrade \
diff --git a/completions/pngfix b/completions/pngfix
new file mode 100644
index 0000000..a927875
--- /dev/null
+++ b/completions/pngfix
@@ -0,0 +1,35 @@
+# pngfix completion                                        -*- shell-script -*-
+
+_pngfix()
+{
+    local cur prev words cword split
+    _init_completion -s || return
+
+    case $prev in
+        --suffix|--prefix)
+            return
+            ;;
+        --output)
+            _filedir
+            return
+            ;;
+        --strip)
+            COMPREPLY=( $( IFS='|' compgen -W '$( "$1" --help 2>&1 |
+                sed -ne "s/.*--strip=\[\([^]]*\)\].*/\1/p" )' -- "$cur" ) )
+            return
+            ;;
+    esac
+
+    $split && return
+
+    if [[ $cur == -* ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+        [[ $COMPREPLY == *= ]] && compopt -o nospace
+        return
+    fi
+
+    _filedir png
+} &&
+complete -F _pngfix pngfix
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/pngfix.exp b/test/completion/pngfix.exp
new file mode 100644
index 0000000..7cea721
--- /dev/null
+++ b/test/completion/pngfix.exp
@@ -0,0 +1 @@
+assert_source_completions pngfix
diff --git a/test/lib/completions/pngfix.exp b/test/lib/completions/pngfix.exp
new file mode 100644
index 0000000..d492610
--- /dev/null
+++ b/test/lib/completions/pngfix.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+    save_env
+}
+
+
+proc teardown {} {
+    assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pngfix "
+sync_after_int
+
+assert_complete_any "pngfix -"
+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