[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-143-g796fbbd

Ville Skyttä ville.skytta at iki.fi
Sat Mar 16 17:31:51 UTC 2013


The following commit has been merged in the master branch:
commit 796fbbdc86e10df67f4930597ce56f9fab5f9457
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Mar 16 19:31:38 2013 +0200

    interdiff: New completion.

diff --git a/completions/Makefile.am b/completions/Makefile.am
index a2c7025..1160813 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -135,6 +135,7 @@ bashcomp_DATA = a2x \
 		inject \
 		insmod \
 		installpkg \
+		interdiff \
 		invoke-rc.d \
 		ionice \
 		ip \
diff --git a/completions/pwgen b/completions/interdiff
similarity index 50%
copy from completions/pwgen
copy to completions/interdiff
index 3aa39a5..8b07572 100644
--- a/completions/pwgen
+++ b/completions/interdiff
@@ -1,16 +1,12 @@
-# pwgen(1) completion                                      -*- shell-script -*-
+# interdiff(1) completion                                  -*- shell-script -*-
 
-_pwgen()
+_interdiff()
 {
     local cur prev words cword split
     _init_completion -s || return
 
     case $prev in
-        -N|--num-passwords|-h|--help)
-            return
-            ;;
-        -H|--sha1)
-            _filedir
+        -U|--unified|-p|--strip-match|-d|--drop-context)
             return
             ;;
     esac
@@ -22,7 +18,16 @@ _pwgen()
         [[ $COMPREPLY == *= ]] && compopt -o nospace
         return
     fi
+
+    local exts='@(?(d)patch|dif?(f))' word
+    for word in ${words[@]}; do
+        if [[ $word == -@(z|-decompress) ]]; then
+            exts+='?(.@(gz|bz2))'
+            break
+        fi
+    done
+    _filedir "$exts"
 } &&
-complete -F _pwgen pwgen
+complete -F _interdiff interdiff
 
 # ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/interdiff.exp b/test/completion/interdiff.exp
new file mode 100644
index 0000000..97bbbde
--- /dev/null
+++ b/test/completion/interdiff.exp
@@ -0,0 +1 @@
+assert_source_completions interdiff
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/interdiff.exp
similarity index 77%
copy from test/lib/completions/abook.exp
copy to test/lib/completions/interdiff.exp
index 43f6272..8880f46 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/interdiff.exp
@@ -11,9 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "abook "
-
-
+assert_complete_any "interdiff "
 sync_after_int
 
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list