[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.90-61-gf271d7e

Igor Murzov e-mail at date.by
Fri Nov 25 00:41:55 UTC 2011


The following commit has been merged in the master branch:
commit f271d7e8db836f126ec20747095086ca01c744bb
Author: Igor Murzov <e-mail at date.by>
Date:   Fri Nov 25 04:33:36 2011 +0300

    nethogs: New completion.

diff --git a/completions/Makefile.am b/completions/Makefile.am
index e67f9d1..8ded90d 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -199,6 +199,7 @@ bashcomp_DATA = a2x \
 		mysql \
 		mysqladmin \
 		ncftp \
+		nethogs \
 		newgrp \
 		newlist \
 		newusers \
diff --git a/completions/nethogs b/completions/nethogs
new file mode 100644
index 0000000..937edf1
--- /dev/null
+++ b/completions/nethogs
@@ -0,0 +1,25 @@
+# bash completion for nethogs(8)                           -*- shell-script -*-
+
+_nethogs()
+{
+    local cur prev words cword
+    _init_completion || return
+
+    case "$prev" in
+        -d)
+            # expect integer value
+            COMPREPLY+=( $( compgen -W '{0..9}' ) )
+            compopt -o nospace
+            return
+            ;;
+    esac
+
+    if [[ "$cur" == -* ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) )
+        return
+    fi
+
+    _available_interfaces -a
+} && complete -F _nethogs nethogs
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/nethogs.exp b/test/completion/nethogs.exp
new file mode 100644
index 0000000..4d501ac
--- /dev/null
+++ b/test/completion/nethogs.exp
@@ -0,0 +1 @@
+assert_source_completions nethogs
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/nethogs.exp
similarity index 79%
copy from test/lib/completions/abook.exp
copy to test/lib/completions/nethogs.exp
index 43f6272..d623407 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/nethogs.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "abook "
+assert_complete_any "nethogs "
 
 
 sync_after_int

-- 
bash-completion



More information about the Bash-completion-commits mailing list