protoc: New completion.
parent
bd07926f65
commit
20045fabef
|
@ -127,6 +127,7 @@ bashcomp_DATA = abook \
|
|||
postgresql \
|
||||
povray \
|
||||
procps \
|
||||
protoc \
|
||||
puppet \
|
||||
python \
|
||||
qdbus \
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
assert_source_completions protoc
|
|
@ -0,0 +1,20 @@
|
|||
proc setup {} {
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "protoc "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
Loading…
Reference in New Issue