blob: ac93e1cab7432a5d2767af27ce1103728e0ca27e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# protoc completion -*- shell-script -*-
_comp_cmd_protoc()
{
local cur prev words cword was_split comp_args
_comp_initialize -s -- "$@" || return
case $prev in
--version | -h | --help | --encode | --decode)
return
;;
--descriptor_set_out)
_comp_compgen_filedir
return
;;
--error_format)
_comp_compgen -- -W 'gcc msvs'
return
;;
--plugin)
[[ $cur == *=* ]] || _comp_compgen_commands
return
;;
--proto_path | --*_out)
_comp_compgen_filedir -d
return
;;
esac
[[ $was_split ]] && return
case $cur in
-o*)
_comp_compgen -c "${cur:2}" filedir
((${#COMPREPLY[@]})) && COMPREPLY=("${COMPREPLY[@]/#/-o}")
return
;;
-I*)
_comp_compgen -c "${cur:2}" filedir -d
((${#COMPREPLY[@]})) && COMPREPLY=("${COMPREPLY[@]/#/-I}")
return
;;
-*)
_comp_compgen_help
local i
for i in "${!COMPREPLY[@]}"; do
[[ ${COMPREPLY[i]} == -oFILE ]] && unset -v 'COMPREPLY[i]'
done
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
return
;;
esac
_comp_compgen_filedir proto
} &&
complete -F _comp_cmd_protoc protoc
# ex: filetype=sh
|