[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-96-g8c57295

Ville Skyttä ville.skytta at iki.fi
Wed Jan 30 20:25:35 UTC 2013


The following commit has been merged in the master branch:
commit 8c572951330bb0ed3a669fd2d8e4dd219430ff11
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Wed Jan 30 22:25:26 2013 +0200

    ngrep: New completion.

diff --git a/completions/Makefile.am b/completions/Makefile.am
index 7fabb72..16fae60 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -223,6 +223,7 @@ bashcomp_DATA = a2x \
 		newgrp \
 		newlist \
 		newusers \
+		ngrep \
 		nmap \
 		nmcli \
 		nslookup \
diff --git a/completions/ngrep b/completions/ngrep
new file mode 100644
index 0000000..7c86764
--- /dev/null
+++ b/completions/ngrep
@@ -0,0 +1,37 @@
+# ngrep(8) completion                                      -*- shell-script -*-
+
+_ngrep()
+{
+    local cur prev words cword
+    _init_completion || return
+
+    case $prev in
+        -h|-V|-n|-A|-s|-S|-c|-P)
+            return
+            ;;
+        -I|-O)
+            _filedir pcap
+            return
+            ;;
+        -d)
+            _available_interfaces -a
+            return
+            ;;
+        -W)
+            COMPREPLY=( $( compgen -W 'normal byline single none' -- "$cur" ) )
+            return
+            ;;
+        -F)
+            _filedir
+            return
+            ;;
+    esac
+
+    if [[ "$cur" == -* ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
+        return
+    fi
+} &&
+complete -F _ngrep ngrep
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/ngrep.exp b/test/completion/ngrep.exp
new file mode 100644
index 0000000..3ad711b
--- /dev/null
+++ b/test/completion/ngrep.exp
@@ -0,0 +1 @@
+assert_source_completions ngrep
diff --git a/test/lib/completions/arping.exp b/test/lib/completions/ngrep.exp
similarity index 68%
copy from test/lib/completions/arping.exp
copy to test/lib/completions/ngrep.exp
index 531bb07..a49543b 100644
--- a/test/lib/completions/arping.exp
+++ b/test/lib/completions/ngrep.exp
@@ -11,10 +11,10 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "arping "
+assert_complete_any "ngrep -"
 sync_after_int
 
-assert_complete_any "arping -"
+assert_complete_any "ngrep -d "
 sync_after_int
 
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list