2024-11-29 11:08:11 -06:00
|
|
|
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 {
|
2024-11-29 12:35:12 -06:00
|
|
|
LoBase string `arg:"--lobase" help:"lowercase basename"`
|
|
|
|
UpBase string `arg:"--upbase" help:"uppercase basename"`
|
|
|
|
Proto string `arg:"--proto" help:"the .proto filename"`
|
2024-11-29 12:59:26 -06:00
|
|
|
Append string `arg:"--append" help:"will keep this key unique on append"`
|
2024-11-29 12:35:12 -06:00
|
|
|
Sort []string `arg:"--sort" help:"how and what to sort on"`
|
|
|
|
Marshal []string `arg:"--marshal" help:"what to marshal on"`
|
|
|
|
NoMarshal bool `arg:"--no-marshal" help:"do not make a marshal.pb.go file"`
|
|
|
|
DryRun bool `arg:"--dry-run" help:"show what would be run"`
|
2024-11-29 11:08:11 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|