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

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

简介#

Prototool 是 Protobuf 文件的生成工具, 目前支持go, php, java, c#, object c 五种语言包的生成.
详情参考Github: https://github.com/uber/prototool

docker 方式使用 prototool 工具#

  • 使用方式
Copy
// 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 文件
Copy
docker run --rm -v $(pwd):/work "uber/prototool" prototool create test.proto

Prototool 部分命令参数简单介绍#

  • prototool lint [目录]

递归的查找所有后缀为 .proto 的文件, 但是不包括 prototool.yamlprototool.json 文件.

Copy
prototool lint testdir

注: 不设置目录, 则默认为当前目录. eg: prototool lint .

  • prototool create [test.proto]

创建一个 proto 的模板文件

Copy
$ prototool create test.proto
  • prototool files [目录]

列出要被使用的所有 proto 文件

Copy
$ prototool files testdir
  • prototool compile [目录]

编译目录下所有的 proto 文件

Copy
$ prototool compile testdir
  • prototool generate [目录]

生成 stubs 文件

Copy
$ prototool generate testdir
  • prototool 帮助文档

查看帮助文档, 这里详细介绍了命令的使用方式.

Copy
$ prototool -h
posted @   Yxh_blogs  阅读(11123)  评论(0编辑  收藏  举报
编辑推荐:
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
点击右上角即可分享
微信分享提示
CONTENTS