[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-139-ge38e68f

Ville Skyttä ville.skytta at iki.fi
Wed Mar 6 16:22:21 UTC 2013


The following commit has been merged in the master branch:
commit 552a2f2a94cf03ef6ee8d53ba8bad1dbb52af640
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Wed Mar 6 18:21:14 2013 +0200

    hexdump: New completion.

diff --git a/completions/.gitignore b/completions/.gitignore
index 23092b1..9dfbe91 100644
--- a/completions/.gitignore
+++ b/completions/.gitignore
@@ -50,6 +50,7 @@ gnumake
 gpc
 hciattach
 hciconfig
+hd
 host
 hping
 hping3
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 96e3f71..479cc09 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -120,6 +120,7 @@ bashcomp_DATA = a2x \
 		gzip \
 		hcitool \
 		hddtemp \
+		hexdump \
 		hid2hci \
 		hping2 \
 		htop \
@@ -430,6 +431,7 @@ CLEANFILES = \
 	gpc \
 	hciattach \
 	hciconfig \
+	hd \
 	host \
 	hping \
 	hping3 \
@@ -663,6 +665,10 @@ symlinks: $(targetdir) $(DATA)
 		rm -f $(targetdir)/$$file && \
 			$(LN_S) hcitool $(targetdir)/$$file ; \
 	done
+	for file in hd ; do \
+		rm -f $(targetdir)/$$file && \
+			$(LN_S) hexdump $(targetdir)/$$file ; \
+	done
 	for file in hping hping3 ; do \
 		rm -f $(targetdir)/$$file && \
 			$(LN_S) hping2 $(targetdir)/$$file ; \
diff --git a/completions/hexdump b/completions/hexdump
new file mode 100644
index 0000000..d043f8b
--- /dev/null
+++ b/completions/hexdump
@@ -0,0 +1,29 @@
+# hexdump(1) completion                                    -*- shell-script -*-
+
+_hexdump()
+{
+    local cur prev words cword
+    _init_completion || return
+
+    case $prev in
+        -V|-e|-n|-s)
+            return
+            ;;
+        -f)
+            _filedir
+            return
+            ;;
+    esac
+
+    if [[ $cur == -* ]]; then
+        local opts="$( _parse_help "$1" )"
+        [[ $opts ]] || opts="$( _parse_usage "$1" )"
+        COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
+        return
+    fi
+
+    _filedir
+} &&
+complete -F _hexdump hexdump
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/hexdump.exp b/test/completion/hexdump.exp
new file mode 100644
index 0000000..7bdc0d3
--- /dev/null
+++ b/test/completion/hexdump.exp
@@ -0,0 +1 @@
+assert_source_completions hexdump
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/hexdump.exp
similarity index 78%
copy from test/lib/completions/abook.exp
copy to test/lib/completions/hexdump.exp
index 43f6272..e344748 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/hexdump.exp
@@ -11,9 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "abook "
-
-
+assert_complete_any "hexdump -"
 sync_after_int
 
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list