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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM