Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mvrilo/protog
Protobuf file generator for the command line
https://github.com/mvrilo/protog
cli command-line generator go golang proto protobuf protoc
Last synced: 3 months ago
JSON representation
Protobuf file generator for the command line
- Host: GitHub
- URL: https://github.com/mvrilo/protog
- Owner: mvrilo
- License: mit
- Created: 2020-05-24T11:08:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-12T21:31:33.000Z (over 4 years ago)
- Last Synced: 2024-10-01T09:21:27.856Z (3 months ago)
- Topics: cli, command-line, generator, go, golang, proto, protobuf, protoc
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# protog
[![GoDoc](https://godoc.org/github.com/mvrilo/protog?status.svg)](https://godoc.org/github.com/mvrilo/protog)
[![Go Report Card](https://goreportcard.com/badge/github.com/mvrilo/protog)](https://goreportcard.com/report/github.com/mvrilo/protog)Protobuf file generator for the command line.
## Installation
```
go get github.com/mvrilo/protog/cmd/protog
```## Usage
```
$ protog -h
protog is a protobuf file generator for the command lineUsage:
protog [-dhfomnsp] [-n option_name:proto_name] [-m MessageName[field:type,field:type,...]] [-s ServiceName[MethodName:In:Out]]Examples:
protog Greet.v1 -m HelloRequest[data:string]Flags:
-d, --dryrun prints the generated proto to stdout
-f, --force overwrite the file if it already exists
-h, --help help for protog
-m, --message stringArray add a message and its fields
-n, --option strings add an option
-o, --output string output dir for the generated proto (default ".")
-p, --package string package name
-s, --service stringArray add a service and its methods
-v, --version version for protog
```## Example Usage
Given the input:
```
protog Greet.v1 \
-n go_package:greet \
-m HelloRequest[data:string] \
-m HelloResponse[id:int64,data:string] \
-s HelloService[SendHello:HelloRequest:HelloResponse,CheckHello] \
-s PingService[SendPing:PingRequest:+PingResponse]
```You should get the file `greet.v1.proto` with the content:
```
syntax = "proto3";package Greet.v1;
option "go_package" = "greet";
import "google/protobuf/empty.proto";
message HelloRequest {
string data = 1;
}message HelloResponse {
string data = 1;
int64 id = 2;
}service HelloService {
rpc SendHello (HelloRequest) returns (HelloResponse) {};
rpc CheckHello (google.protobuf.Empty) returns (google.protobuf.Empty) {};
}service PingService {
rpc SendPing (PingRequest) returns (stream PingResponse) {};
}
```## Author
Murilo Santana <>
## License
MIT