[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-136-gad8d1f1

Ville Skyttä ville.skytta at iki.fi
Fri Feb 22 20:15:39 UTC 2013


The following commit has been merged in the master branch:
commit ad8d1f1a8f879e696956ce0bd7733ef5f3365a6b
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Feb 22 22:15:33 2013 +0200

    strings: New completion.

diff --git a/completions/Makefile.am b/completions/Makefile.am
index b15b7df..38450ac 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -313,6 +313,7 @@ bashcomp_DATA = a2x \
 		sshmitm \
 		sshow \
 		strace \
+		strings \
 		su \
 		sudo \
 		svcadm \
diff --git a/completions/strings b/completions/strings
new file mode 100644
index 0000000..8f47d37
--- /dev/null
+++ b/completions/strings
@@ -0,0 +1,44 @@
+# strings(1) completion                                    -*- shell-script -*-
+
+_strings()
+{
+    local cur prev words cword split
+    _init_completion -s || return
+
+    case $prev in
+        -h|--help|-v|-V|--version|-n|--bytes)
+            return
+            ;;
+        -t|--radix)
+            COMPREPLY=( $( compgen -W 'o d x' -- "$cur" ) )
+            return
+            ;;
+        -T|--target)
+            COMPREPLY=( $( compgen -W '$( "$1" --help 2>/dev/null | \
+                sed -ne "s/: supported targets: \(.*\)/\1/p" )' -- "$cur" ) )
+            return
+            ;;
+        -e|--encoding)
+            COMPREPLY=( $( compgen -W 's S b l B L' -- "$cur" ) )
+            return
+            ;;
+    esac
+
+    $split && return
+
+    if [[ $cur == -* ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+        [[ $COMPREPLY == *= ]] && compopt -o nospace
+        return
+    elif [[ $cur == @* ]]; then
+        cur=${cur:1}
+        _filedir
+        COMPREPLY=( "${COMPREPLY[@]/#/@}" )
+        return
+    fi
+
+    _filedir
+} &&
+complete -F _strings strings
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/strings.exp b/test/completion/strings.exp
new file mode 100644
index 0000000..a5c544a
--- /dev/null
+++ b/test/completion/strings.exp
@@ -0,0 +1 @@
+assert_source_completions strings
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/strings.exp
similarity index 78%
copy from test/lib/completions/abook.exp
copy to test/lib/completions/strings.exp
index 43f6272..103d5d3 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/strings.exp
@@ -11,9 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "abook "
-
-
+assert_complete_any "strings "
 sync_after_int
 
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list