47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
|
package main
|
||
|
|
||
|
/*
|
||
|
this parses the command line arguements
|
||
|
|
||
|
this enables command line options from other packages like 'gui' and 'log'
|
||
|
*/
|
||
|
|
||
|
var argv args
|
||
|
|
||
|
type args struct {
|
||
|
Base string `arg:"--base" help:"basename"`
|
||
|
Proto string `arg:"--proto" help:"the .proto filename"`
|
||
|
}
|
||
|
|
||
|
func (a args) Description() string {
|
||
|
return `
|
||
|
autogenpb tries to generate a sort.pb.go file for a protobuf
|
||
|
|
||
|
Install with:
|
||
|
|
||
|
go install go.wit.com/apps/autogenpb@latest
|
||
|
|
||
|
More information at:
|
||
|
|
||
|
https://go.wit.com/
|
||
|
|
||
|
The protobuf is assumed to have a 'standard' format.
|
||
|
|
||
|
That is the .proto file:
|
||
|
|
||
|
* only defines one thing and it's the same name as the file
|
||
|
* uses the concept of 'plural' (like ruby on rails)
|
||
|
This means, the file should be "apples.proto" and inside
|
||
|
have 'message Apple' and 'message Apples'
|
||
|
The "message Apples" should have a repeated Apple apples
|
||
|
|
||
|
There is an example in the code:
|
||
|
|
||
|
go-clone go.wit.com/apps/autogenpb
|
||
|
`
|
||
|
}
|
||
|
|
||
|
func (args) Version() string {
|
||
|
return "go-clone " + VERSION + " Built on " + BUILDTIME
|
||
|
}
|