summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-29 11:21:56 -0600
committerJeff Carr <[email protected]>2024-11-29 11:21:56 -0600
commitba981d6bb2f31fae2c983e81da0c654f2b4f1593 (patch)
treea82e5e9259a097c483c2433c1f3c45fa61172696 /main.go
parent8158a66db580bcfbb89c1d51002b1d07c15fa960 (diff)
only sort keys left
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r--main.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/main.go b/main.go
index cf03e66..5390e9c 100644
--- a/main.go
+++ b/main.go
@@ -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"