[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-396-gd552dac

Ville Skyttä ville.skytta at iki.fi
Tue Jul 5 16:30:38 UTC 2011


The following commit has been merged in the master branch:
commit 20045fabef2348f327463dc067f7866c0f41cbae
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Jul 5 19:26:16 2011 +0300

    protoc: New completion.

diff --git a/completions/Makefile.am b/completions/Makefile.am
index a7ad5ed..62d6188 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -127,6 +127,7 @@ bashcomp_DATA = abook \
 		postgresql \
 		povray \
 		procps \
+		protoc \
 		puppet \
 		python \
 		qdbus \
diff --git a/completions/protoc b/completions/protoc
new file mode 100644
index 0000000..26a1096
--- /dev/null
+++ b/completions/protoc
@@ -0,0 +1,69 @@
+have protoc || return
+
+_protoc()
+{
+    local cur prev words cword split
+    _init_completion -s || return
+
+    case $prev in
+        --proto_path|--cpp_out|--java_out|--python_out)
+            _filedir -d
+            return
+            ;;
+        --version|-h|--help|--encode|--decode)
+            return
+            ;;
+        --descriptor_set_out)
+            _filedir
+            return
+            ;;
+        --error_format)
+            COMPREPLY=( $( compgen -W 'gcc msvs' -- "$cur" ) )
+            return
+            ;;
+        --plugin)
+            if [[ $cur != *=* ]]; then
+                compopt -o filenames
+                COMPREPLY=( $( compgen -c -- "$cur" ) )
+            fi
+            return
+            ;;
+    esac
+
+    $split && return
+
+    case $cur in
+        -o*)
+            cur=${cur:2}
+            _filedir
+            COMPREPLY=( "${COMPREPLY[@]/#/-o}" )
+            return
+            ;;
+        -I*)
+            cur=${cur:2}
+            _filedir -d
+            COMPREPLY=( "${COMPREPLY[@]/#/-I}" )
+            return
+            ;;
+        -*)
+            COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+            local i
+            for i in ${!COMPREPLY[@]}; do
+                [[ ${COMPREPLY[i]} == -oFILE ]] && unset COMPREPLY[i]
+            done
+            [[ $COMPREPLY == *= ]] && compopt -o nospace
+            return
+            ;;
+    esac
+
+    _filedir proto
+} &&
+complete -F _protoc protoc
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/protoc.exp b/test/completion/protoc.exp
new file mode 100644
index 0000000..333ebf2
--- /dev/null
+++ b/test/completion/protoc.exp
@@ -0,0 +1 @@
+assert_source_completions protoc
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/protoc.exp
similarity index 79%
copy from test/lib/completions/a2ps.exp
copy to test/lib/completions/protoc.exp
index 77cd07f..caeb827 100644
--- a/test/lib/completions/a2ps.exp
+++ b/test/lib/completions/protoc.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "a2ps "
+assert_complete_any "protoc "
 
 
 sync_after_int

-- 
bash-completion



More information about the Bash-completion-commits mailing list