autogenpb/argv.go

50 lines
1.3 KiB
Go
Raw Normal View History

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 {
LoBase string `arg:"--lobase" help:"lowercase basename"`
UpBase string `arg:"--upbase" help:"uppercase basename"`
Proto string `arg:"--proto" help:"the .proto filename"`
Sort []string `arg:"--sort" help:"how and what to sort on"`
DryRun bool `arg:"--dry-run" help:"show what would be run"`
}
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
}