Prototool 是 Protobuf 文件的生成工具, 目前支持go, php, java, c#, object c 五种语言包的生成.
详情参考Github: https://github.com/uber/prototoolphp
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
文件.java
prototool lint testdir
注: 不设置目录, 则默认为当前目录. eg: prototool lint .
git
prototool create [test.proto]
建立一个 proto
的模板文件github
$ prototool create test.proto
prototool files [目录]
列出要被使用的全部 proto
文件docker
$ prototool files testdir
prototool compile [目录]
编译目录下全部的 proto
文件json
$ prototool compile testdir
prototool generate [目录]
生成 stubs
文件c#
$ prototool generate testdir
prototool
帮助文档查看帮助文档, 这里详细介绍了命令的使用方式.工具
$ prototool -h