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

Ville Skyttä ville.skytta at iki.fi
Thu Sep 9 21:13:05 UTC 2010


The following commit has been merged in the master branch:
commit c78db545f56bb7d29eb71953f0e0660e843515b3
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Sep 10 00:12:03 2010 +0300

    Add iftop(8) completion.

diff --git a/CHANGES b/CHANGES
index 79c8396..a2a317a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -8,7 +8,7 @@ bash-completion (2.x)
 
   [ Ville Skyttä ]
   * Activate hping2 completion also for hping and hping3.
-  * Add crontab, lrzip, and POSIX sh completions.
+  * Add crontab, iftop, lrzip, and POSIX sh completions.
   * Add *.gif (Alioth: #312512), *.3gpp, *.3gpp2, and *.awb to mplayer
     filename completions.
   * Add "short" tarball extensions to unxz, unlzma etc completions.
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 3733c60..ea129d0 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -51,6 +51,7 @@ static_bashcomp = abook \
 		heimdal \
 		hping2 \
 		iconv \
+		iftop \
 		ifupdown \
 		imagemagick \
 		info \
diff --git a/contrib/tcpdump b/contrib/iftop
similarity index 58%
copy from contrib/tcpdump
copy to contrib/iftop
index 259f13e..eefcf9c 100644
--- a/contrib/tcpdump
+++ b/contrib/iftop
@@ -1,32 +1,30 @@
-# bash completion for tcpdump
+# iftop(8) completion
 
-have tcpdump &&
-_tcpdump()
+have iftop &&
+_iftop()
 {
-    local cur prev
-
     COMPREPLY=()
+    local cur prev
     _get_comp_words_by_ref cur prev
 
     case $prev in
-        -r|-w|-F)
-            _filedir
+        -h|-f|-F|-m)
             return 0
             ;;
         -i)
             _available_interfaces -a
             return 0
             ;;
+        -c)
+            _filedir
+            return 0
+            ;;
     esac
 
-
-    if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \
-            -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w -E' -- "$cur" ) )
-    fi
-
+    COMPREPLY=( $( compgen -W '-h -n -N -p -P -b -B -i -f -F -c -m' \
+        -- "$cur" ) )
 } &&
-complete -F _tcpdump tcpdump
+complete -F _iftop -o filenames iftop
 
 # Local variables:
 # mode: shell-script
diff --git a/test/completion/iftop.exp b/test/completion/iftop.exp
new file mode 100644
index 0000000..5ec1cb5
--- /dev/null
+++ b/test/completion/iftop.exp
@@ -0,0 +1 @@
+assert_source_completions iftop
diff --git a/test/lib/completions/awk.exp b/test/lib/completions/iftop.exp
similarity index 80%
copy from test/lib/completions/awk.exp
copy to test/lib/completions/iftop.exp
index 260dabc..1294161 100644
--- a/test/lib/completions/awk.exp
+++ b/test/lib/completions/iftop.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "awk "
+assert_complete_any "iftop "
 
 
 sync_after_int

-- 
bash-completion



More information about the Bash-completion-commits mailing list