From ec669a62c02da925dc5659d4525ff4eba05fae11 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 4 Oct 2025 15:30:09 -0500 Subject: smart exit function --- auto.proto | 2 +- exit.go | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 exit.go 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) +} -- cgit v1.2.3