Protobuf 文件生成工具 Prototool 命令详解

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.yamlprototool.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

转载于:https://www.cnblogs.com/yxhblogs/p/10884602.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值