summaryrefslogtreecommitdiff
path: root/init.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-21 15:48:24 -0500
committerJeff Carr <[email protected]>2025-10-21 15:48:24 -0500
commit2b6414a664fd7ccc519874f4d0b55a12a871307c (patch)
treeb72eba5a53e98a219f4a54249241e2fd9b66e6d8 /init.go
parente9c3000abafd70702cb9db6e3738115012f498eb (diff)
housecleaning
Diffstat (limited to 'init.go')
-rw-r--r--init.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/init.go b/init.go
new file mode 100644
index 0000000..9feed7f
--- /dev/null
+++ b/init.go
@@ -0,0 +1,36 @@
+package argvpb
+
+import (
+ "time"
+
+ "go.wit.com/lib/cobol"
+ "go.wit.com/log"
+)
+
+// gets APPNAME, BUILDTIME and VERSION from the application
+func initAppname() {
+ app := new(App)
+ APPNAME, anyString, VERSION := me.initArgvFunc()
+ app.APPNAME = APPNAME
+ app.VERSION = VERSION
+ //
+ // this logic isn't great, but it's what it is right now
+ //
+ // the reason this logic is messy is because cobol is supposed to "guess"
+ // that is the point of the cobol package and I've been using this code here
+ // to test the guesses because it's an easy place to test that code
+ //
+ if BUILDTIME, err := cobol.GetTime(anyString); BUILDTIME != nil {
+ // everyhting is working. BUILDTIME is *time.Time
+ app.BUILDTIME = cobol.Time(BUILDTIME)
+ } else if err == nil {
+ newtime := BUILDTIME.Add(-36 * time.Hour)
+ app.BUILDTIME = cobol.Time(BUILDTIME)
+ log.Printf("TIME initAppname() ERR=(%v) anyString=(%v) GetTime.BUILTIME=(%v) app.BUILDTIME=(%v)\n", err, anyString, newtime, app.BUILDTIME)
+ } else {
+ app.BUILDTIME = anyString
+ log.Printf("TIME initAppname() ERR=(%v) anyString=(%v) GetTime.BUILTIME=(%v) app.BUILDTIME=(%v)\n", err, anyString, BUILDTIME, app.BUILDTIME)
+ }
+ me.pb.AppInfo = app
+ me.pb.Argname = APPNAME // deprecate this
+}