-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
_protoc
71 lines (65 loc) · 4.01 KB
/
_protoc
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
59
60
61
62
63
64
65
66
67
68
69
70
71
#compdef protoc
# -----------------------------------------------------------------------------
# The BSD-3-Clause License
#
# Copyright (c) 2016, Koichi Shiraishi
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of que nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
function _protoc() {
local context curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments \
{-I,--proto_path}'[Specify the directory in which to search for imports]:PATH' \
'--version[Show version info and exit]' \
{-h,--help}'[Show this text and exit]' \
'--encode[Read a text-format message of the given type from standard input and write it in binary to standard output]:MESSAGE_TYPE' \
'--decode[Read a binary message of the given type from standard input and write it in text format to standard output]:MESSAGE_TYPE' \
'--decode_raw[Read an arbitrary protocol message from standard input and write the raw tag/value pairs in text format to standard output]' \
{-o,--descriptor_set_out}='[Writes a FileDescriptorSet (a protocol buffer, defined in descriptor.proto) containing all of the input files to FILE]:FILE' \
'--include_imports[When using --descriptor_set_out, also include all dependencies of the input files in the set, so that the set is self-contained]' \
'--include_source_info[When using --descriptor_set_out, do not strip SourceCodeInfo from the FileDescriptorProto]' \
'--dependency_out[Write a dependency output file in the format expected by make. This writes the transitive set of input file paths to FILE]:FILE' \
'--error_format[Set the format in which to print errors]:error format:(gcc msvs)' \
'--print_free_field_numbers[Print the free field numbers of the messages defined in the given proto files. Groups share the same field number space with the parent message]' \
'--plugin[Specifies a plugin executable to use. Normally, protoc searches the PATH for plugins, but you may specify additional executables not in the path using this flag]:EXECUTABLE' \
'--cpp_out[Generate C++ header and source]:OUT_DIR' \
'--csharp_out[Generate C# source file]:OUT_DIR' \
'--java_out[Generate Java source file]:OUT_DIR' \
'--javanano_out=[Generate Java Nano source file]:OUT_DIR' \
'--js_out[Generate JavaScript source]:OUT_DIR' \
'--objc_out[Generate Objective C header and source]:OUT_DIR' \
'--php_out[Generate PHP source file]:OUT_DIR' \
'--python_out[Generate Python source file]:OUT_DIR' \
'--ruby_out[Generate Ruby source file]:OUT_DIR' \
'*::proto file:_files' \
&& ret=0
return ret
}
_protoc "$*"
# vim:ft=zsh:et:sts=2:sw=2