diff options
| author | Jeff Carr <[email protected]> | 2025-10-08 10:45:52 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-08 10:45:52 -0500 |
| commit | ef54151d1177241534679da170f5b1c6f1aa893d (patch) | |
| tree | 65d462137cfde039f2839000a773e909e2568cb3 /main.go | |
| parent | 6ee19a4e85ba449555f6fe0e51338e2d9882f611 (diff) | |
notsurev0.1.27
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -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 +} |
