1:-IPATH, --proto_path=PATH
原文說明: Specify the directory in which to search for imports. May be specified multiple times;directories will be searched in order. If not given, the current working directory is used.
If not found in any of the these directories,the --descriptor_set_in descriptors will be checked for required proto file.
翻譯:指定要在其中搜索導入的目錄。可以多次指定;將按順序搜索目錄。如果未給定,則使用當前工作目錄。若在這些目錄中找不到任何一個,
將檢查描述符中的--descriptor_set_in 獲取所需的proto文件。
2: --version
Show version info and exit.
3: -h, --help
Show this text and exit.
4:--encode=MESSAGE_TYPE
原文說明:Read a text-format message of the given type from standard input and write it in binary to standard output. The message type must be defined in PROTO_FILES or their imports.
翻譯:從標准輸入讀取給定類型的文本格式消息,並將其以二進制形式寫入標准輸出。消息類型必須在PROTO_FILES或其導入中定義。
5:--decode=MESSAGE_TYPE
原文說明:Read a binary message of the given type from standard input and write it in text format to standard output. The message type must be defined in PROTO_FILES or their imports.
翻譯:從標准輸入讀取給定類型的二進制消息,並將其以文本格式寫入標准輸出。消息類型必須在PROTO_FILES或其導入中定義。
6: --decode_raw
原文說明:Read an arbitrary protocol message fromstandard input and write the raw tag/value pairs in text format to standard output. No PROTO_FILES should be given when using this flag.
翻譯:從標准輸入讀取任意協議消息,並以文本格式將原始標記/值對寫入標准輸出。使用此標志時不應給出任何PROTO_FILES。
7: --descriptor_set_in=FILES
原文說明: Specifies a delimited list of FILES each containing a FileDescriptorSet (a protocol buffer defined in descriptor.proto).The FileDescriptor for each of the PROTO_FILES provided will be loaded from these FileDescriptorSets. If a FileDescriptor appears multiple times, the first occurrence will be used.
翻譯:指定一個文件的分隔列表,每個文件都包含一個文件描述符集(在descriptor.proto中定義的協議緩沖區)文件描述符。如果文件描述符多次出現,則將使用第一次出現的文件描述符。
8:-oFILE,
原文說明: Writes a FileDescriptorSet (a protocol buffer,defined in descriptor.proto) containing all of the input files to FILE.
翻譯:寫入文件描述符集(協議緩沖區,--descriptor_set_out=在descriptor.proto)中定義的文件,包含要歸檔的輸入文件。
--descriptor_set_out=FILE
9:--include_imports
原文說明:When using --descriptor_set_out, also includeall dependencies of the input files in the set, so that the set is self-contained.
翻譯:當使用--descriptor_set_out時,還包括集合中輸入文件的依賴項,以便集合是自包含的。
10:--include_source_info
原文說明:When using --descriptor_set_out, do not strip SourceCodeInfo from the FileDescriptorProto.This results in vastly larger descriptors that include information about the original
location of each decl in the source file as well as surrounding comments.
翻譯:當使用--descriptor_-set_-out時,不要從文件描述符Proto中刪除源代碼信息。這會導致更大的描述符,其中包括源文件中每個decl的原始位置信息以及周圍的注釋。
11: --dependency_out=FILE
原文說明: Write a dependency output file in the format expected by make. This writes the transitive set of input file paths to FILE
翻譯: 以make所期望的格式編寫依賴項輸出文件。這將輸入文件路徑的可傳遞集寫入文件
12: --error_format=FORMAT
原文說明:Set the format in which to print errors. FORMAT may be 'gcc' (the default) or 'msvs' (Microsoft Visual Studio format).
翻譯:設置打印錯誤的格式。格式可以是“gcc”(默認)或“msvs”(Microsoft Visual Studio格式)。
13: --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.
Extension ranges are counted as occupied fields numbers.
翻譯:打印給定proto文件中定義的消息的可用字段號。組與父郵件共享相同的字段號空間。擴展范圍計算為占用字段編號。
14: --plugin=EXECUTABLE
原文說明: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.
Additionally, EXECUTABLE may be of the form NAME=PATH, in which case the given plugin name is mapped to the given executable even if the executable's own name differs.
翻譯:指定要使用的插件可執行文件。通常,protoc會在路徑中搜索插件,但您可以使用此標志指定不在路徑中的其他可執行文件。
此外,可執行文件的格式可以是NAME=PATH,在這種情況下,即使可執行文件的自身名稱不同,給定的插件名稱也映射到給定的可執行文件。
15:
--cpp_out=OUT_DIR Generate C++ header and source.
--csharp_out=OUT_DIR Generate C# source file.
--java_out=OUT_DIR Generate Java source file.
--js_out=OUT_DIR Generate JavaScript source.
--objc_out=OUT_DIR Generate Objective C header and source.
--php_out=OUT_DIR Generate PHP source file.
--python_out=OUT_DIR Generate Python source file.
--ruby_out=OUT_DIR Generate Ruby source file.
16: @<filename>
Read options and filenames from file. If a relative file path is specified, the file will be searched in the working directory.The --proto_path option will not affect how
this argument file is searched. Content of the file will be expanded in the position of @<filename> as in the argument list. Note that shell expansion is not applied to the
content of the file (i.e., you cannot use quotes, wildcards, escapes, commands, etc.). Each line corresponds to a single argument, even if it contains spaces.
從文件中讀取選項和文件名。如果指定了相對文件路徑,則將在工作目錄中搜索該文件已搜索此參數文件。文件的內容將在參數列表中@<filename>的位置展開。注意,shell擴展不適用於
文件內容(即,不能使用引號、通配符、轉義符、命令等)。每一行對應一個參數,即使它包含空格。
示例:
protoc -I F:\C#\202002\ConsoleApp1\GrpcGen --csharp_out=F:\C#\202002\ConsoleApp1\GrpcGen --grpc_out F:\C#\202002\ConsoleApp1\GrpcGen --plugin=protoc-gen-grpc=grpc_csharp_plugin.exe HelloWorld.proto