diff options
| author | Jeff Carr <[email protected]> | 2024-11-29 11:21:56 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-29 11:21:56 -0600 |
| commit | ba981d6bb2f31fae2c983e81da0c654f2b4f1593 (patch) | |
| tree | a82e5e9259a097c483c2433c1f3c45fa61172696 /main.go | |
| parent | 8158a66db580bcfbb89c1d51002b1d07c15fa960 (diff) | |
only sort keys left
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -18,12 +18,6 @@ var BUILDTIME string func main() { pp := arg.MustParse(&argv) - // for very new users or users unfamilar with the command line, this may help them - if argv.Base == "help" || argv.Base == "?" { - pp.WriteHelp(os.Stdout) - os.Exit(-1) - } - // you need a proto file if argv.Proto == "" { log.Info("you must provide --proto <filename>") @@ -35,11 +29,17 @@ func main() { os.Exit(-1) } - if ! strings.HasSuffix(argv.Proto, ".proto") { + if !strings.HasSuffix(argv.Proto, ".proto") { log.Info("protobuf", argv.Proto, "must end in .proto") os.Exit(-1) } + // you need --upbase and --lobase + if argv.UpBase == "" { + pp.WriteHelp(os.Stdout) + os.Exit(-1) + } + cmd := []string{"go", "list", "-f", "'{{.Name}}'"} result := shell.Run(cmd) @@ -50,13 +50,13 @@ func main() { protobase := strings.TrimSuffix(argv.Proto, ".proto") - f, _ := os.OpenFile(protobase + ".sort.pb.go", os.O_WRONLY|os.O_CREATE, 0600) + f, _ := os.OpenFile(protobase+".sort.pb.go", os.O_WRONLY|os.O_CREATE, 0600) sortmap := make(map[string]string) sortmap["package"] = packageName - sortmap["base"] = "gitTag" + sortmap["base"] = argv.LoBase sortmap["lock"] = sortmap["base"] + "slock" - sortmap["Base"] = "GitTag" + sortmap["Base"] = argv.UpBase sortmap["Bases"] = sortmap["Base"] + "s" sortmap["sortBy"] = "ByPath" |
