Protobuf 文件生成工具 Prototool 命令詳解
簡介
Prototool 是 Protobuf 文件的生成工具, 目前支持go, php, java, c#, object c 五種語言包的生成.
詳情參考Github: https://github.com/uber/prototool
docker
方式使用 prototool
工具
- 使用方式
// prototool 的使用
docker run --rm -v $(pwd):/work "uber/prototool" prototool
// 格式化 proto 文件
docker run --rm -v $(pwd):/work "uber/prototool" prototool format -l proto
// 編譯, 格式化, 覆蓋 proto 文件
docker run --rm -v $(pwd):/work "uber/prototool" prototool all proto
docker
方式創建proto
文件
docker run --rm -v $(pwd):/work "uber/prototool" prototool create test.proto
Prototool
部分命令參數簡單介紹
prototool lint [目錄]
遞歸的查找所有后綴為 .proto
的文件, 但是不包括 prototool.yaml
和 prototool.json
文件.
prototool lint testdir
注: 不設置目錄, 則默認為當前目錄. eg: prototool lint .
prototool create [test.proto]
創建一個 proto
的模板文件
$ prototool create test.proto
prototool files [目錄]
列出要被使用的所有 proto
文件
$ prototool files testdir
prototool compile [目錄]
編譯目錄下所有的 proto
文件
$ prototool compile testdir
prototool generate [目錄]
生成 stubs
文件
$ prototool generate testdir
prototool
幫助文檔
查看幫助文檔, 這里詳細介紹了命令的使用方式.
$ prototool -h