summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-04 15:30:09 -0500
committerJeff Carr <[email protected]>2025-10-04 15:30:09 -0500
commitec669a62c02da925dc5659d4525ff4eba05fae11 (patch)
treeebaf5a2009dde9e763f8e514f0cdbb53d590a770
parent85885a09373e59c8a8ea0bfc015bee647182fd32 (diff)
smart exit function
-rw-r--r--auto.proto2
-rw-r--r--exit.go20
2 files changed, 21 insertions, 1 deletions
diff --git a/auto.proto b/auto.proto
index 7a470ef..ef6c974 100644
--- a/auto.proto
+++ b/auto.proto
@@ -28,5 +28,5 @@ message Auto { // `autogenpb:marshal` `
message Autos { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:nomutex`
string uuid = 1; // `autogenpb:uuid:94210ebf-a534-4b33-aadd-2f5e1f56ae38`
string version = 2; // `autogenpb:version:v0.0.1`
- repeated Auto autos = 3; // THIS MUST BE HttpRequest and then HttpRequests
+ repeated Auto autos = 3;
}
diff --git a/exit.go b/exit.go
new file mode 100644
index 0000000..3581330
--- /dev/null
+++ b/exit.go
@@ -0,0 +1,20 @@
+package prep
+
+import (
+ "os"
+ "time"
+
+ "go.wit.com/lib/gui/shell"
+ "go.wit.com/log"
+)
+
+// initializes logging and command line options
+
+func (pb *Auto) BadExit(msg string, err error) {
+ if err != nil {
+ log.Info(err)
+ }
+ dur := time.Since(pb.Ctime.AsTime())
+ log.Infof("%s: %s (%s)\n", pb.Argname, msg, shell.FormatDuration(dur))
+ os.Exit(-1)
+}