From 67809c6d898489b65573c6dfb4059aeef3258e69 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 10 Oct 2025 15:33:47 -0500 Subject: moved to config --- Makefile | 2 +- argv.go | 2 +- main.go | 27 +++++++++------------------ 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index d17475a..26676aa 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ deb: forge normal deb-forcedirty: - wit build deb --verbose --force --all + wit build deb --verbose --force forge normal deb-all: diff --git a/argv.go b/argv.go index c0ad298..9a4a60f 100644 --- a/argv.go +++ b/argv.go @@ -48,7 +48,7 @@ type BuildCmd struct { } type ProtoCmd struct { - Indentify string `arg:"--identify" help:"identify a .pb file"` + Identify string `arg:"--identify" help:"identify a .pb file"` } type LinuxCmd struct { diff --git a/main.go b/main.go index ca606c0..6266cc9 100644 --- a/main.go +++ b/main.go @@ -65,7 +65,15 @@ func main() { } if argv.PB != nil { - s, err = doIdentifyPB("unknown.pb") + pbuuid, pbver, pberr := filepb.IdentifyPB(argv.PB.Identify) + if pberr == nil { + log.Info("pb version is:", pbver) + log.Info("pb uuid is:", pbuuid) + s = "pb identify worked" + } else { + s = "identify failed" + err = pberr + } } if argv.Clone != nil { @@ -120,20 +128,3 @@ func trimNonNumericFromStart(s string) string { } return "" } - -// print the protobuf in human form -func doIdentifyPB(filename string) (string, error) { - data, err := os.ReadFile(filename) - if err != nil { - // log.Info("open config file :", err) - return "os.ReadFile()", err - } - - var pb *filepb.Identify - pb = new(filepb.Identify) - if err := pb.Unmarshal(data); err != nil { - return "Unmarshal(data)", err - } - log.Info("Identify protobuf file uuid =", pb.Uuid, "version =", pb.Version) - return "file identify worked!", nil -} -- cgit v1.2.3