From ef54151d1177241534679da170f5b1c6f1aa893d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 8 Oct 2025 10:45:52 -0500 Subject: notsure --- main.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/main.go b/main.go index 8ec2446..de887c5 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,8 @@ import ( "unicode" "go.wit.com/lib/gui/prep" + "go.wit.com/lib/protobuf/filepb" + "go.wit.com/log" ) // sent via -ldflags @@ -43,6 +45,9 @@ func main() { } if argv.Git != nil { + initMachine() + me.sh.GoodExit("") + s, err := doGit() if err != nil { me.sh.BadExit(s, err) @@ -50,6 +55,24 @@ func main() { me.sh.GoodExit(s) } + if argv.PB != nil { + s, err := doIdentifyPB("unknown.pb") + if err != nil { + me.sh.BadExit(s, err) + } + me.sh.GoodExit(s) + } + + if argv.Clone != nil { + doClone() + me.sh.GoodExit("") + } + + if argv.WITCOM { + doWITCOM() + me.sh.GoodExit("") + } + if argv.Clone != nil { doClone() me.sh.GoodExit("") @@ -90,3 +113,20 @@ 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