summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-18 10:42:40 -0500
committerJeff Carr <[email protected]>2025-10-18 10:42:40 -0500
commitce1745d37a24bf95f70463e558d792419b37de6f (patch)
tree4df955dc87ca8a920075ae797c37bd8a47195117
parent748ac1d8c6bb87c2c8e7c9e2db2608ee1a0a9979 (diff)
notsure. need to redo this still
-rw-r--r--argv.Version.go20
-rw-r--r--interface.go25
-rw-r--r--parseOsArgs.go8
-rw-r--r--structs.go4
-rw-r--r--theMagicOfAutocomplete.go3
5 files changed, 38 insertions, 22 deletions
diff --git a/argv.Version.go b/argv.Version.go
index 0aaa75d..117c655 100644
--- a/argv.Version.go
+++ b/argv.Version.go
@@ -10,24 +10,30 @@ import (
"go.wit.com/log"
)
+/*
func (pb *Argv) Version() string {
return pb.getVersion()
}
+*/
func doVersion(pb *Argv) {
- log.Info(pb.getVersion())
+ // log.Info(pb.getVersion())
+ s := fmt.Sprintf("%s %s Built on raw(%v) %s (from argv)", me.ARGNAME, me.VERSION, me.BUILDTIME, cobol.Time(me.BUILDTIME))
+ log.Info(s)
os.Exit(0)
}
+/*
func (pb *Argv) getVersion() string {
- if me.buildtime == nil {
- return "app doesn't have argv.BuildVersion()"
- }
- BUILDTIME, VERSION := me.buildtime()
+ // if me.buildtime == nil {
+ // return "app doesn't have argv.BuildVersion()"
+ // }
+ // BUILDTIME, VERSION := me.buildtime()
- return fmt.Sprintf("%s %s Built on %s", pb.Argname, VERSION, cobol.Time(BUILDTIME))
+ return fmt.Sprintf("%s %s Built on raw(%s) %s", pb.Argname, me.VERSION, me.BUILDTIME, cobol.Time(me.BUILDTIME))
}
+*/
func StandardVersion(ARGNAME, VERSION, BUILDTIME string) string {
- return fmt.Sprintf("%s %s Built on %s", ARGNAME, VERSION, cobol.Time(BUILDTIME))
+ return fmt.Sprintf("%s %s Built on raw(%v) %s (from argv)", ARGNAME, VERSION, BUILDTIME, cobol.Time(BUILDTIME))
}
diff --git a/interface.go b/interface.go
index a21a0b4..166eb14 100644
--- a/interface.go
+++ b/interface.go
@@ -1,6 +1,9 @@
package argvpb
-import "go.wit.com/log"
+import (
+ "go.wit.com/lib/cobol"
+ "go.wit.com/log"
+)
// this is a work in progress
@@ -83,7 +86,11 @@ type exitI interface {
func findAppInfo(tmp interface{}) {
// THIS STUFF IS FINALIZED FOR NOW 2025/10/18 (review in a few months)
if tmp, ok := tmp.(initArgvI); ok {
- me.ARGNAME, me.BUILDTIME, me.VERSION = tmp.InitArgv()
+ var anyTime string
+ var err error
+ me.ARGNAME, anyTime, me.VERSION = tmp.InitArgv()
+ me.BUILDTIME, err = cobol.GetTime(anyTime)
+ _ = err
} else {
panic("you must define in your app the function: (args) func InitArgv() (string, string, string)")
}
@@ -135,12 +142,14 @@ func findAppInfo(tmp interface{}) {
// panic("you must define in your app the function: (argv) func Appname() string")
}
- if tmp, ok := tmp.(buildtimeI); ok {
- me.buildtime = tmp.Buildtime
- me.BUILDTIME, me.VERSION = me.buildtime()
- } else {
- // panic("your app is missing (argv) func Buildtime() (string, string)")
- }
+ /*
+ if tmp, ok := tmp.(buildtimeI); ok {
+ me.buildtime = tmp.Buildtime
+ me.BUILDTIME, me.VERSION = me.buildtime()
+ } else {
+ // panic("your app is missing (argv) func Buildtime() (string, string)")
+ }
+ */
if tmp, ok := tmp.(examplesI); ok {
me.examples = tmp.Examples
diff --git a/parseOsArgs.go b/parseOsArgs.go
index c91c1e5..4959944 100644
--- a/parseOsArgs.go
+++ b/parseOsArgs.go
@@ -66,11 +66,9 @@ func parseArgv(argname string) *Argv {
// print the version and exit
if len(os.Args) > 1 && os.Args[1] == "--version" {
- if me.buildtime != nil {
- // if binary defined buildtime() then process standard version output here
- doVersion(pb)
- os.Exit(0)
- }
+ // if binary defined buildtime() then process standard version output here
+ doVersion(pb)
+ os.Exit(0)
}
if os.Args[1] != "--auto-complete" {
diff --git a/structs.go b/structs.go
index 1cf5b91..2633128 100644
--- a/structs.go
+++ b/structs.go
@@ -1,5 +1,7 @@
package argvpb
+import "time"
+
// try this struct out (?)
var me *AutoArgs
@@ -23,7 +25,7 @@ type AutoArgs struct {
guiFunc func() error // enables Gui functions
ARGNAME string // a good way to track the name of the binary ?
VERSION string
- BUILDTIME string
+ BUILDTIME *time.Time
err error // store any errors from argv
// hidden bool // don't update the toolkits when it's hidden
// pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
diff --git a/theMagicOfAutocomplete.go b/theMagicOfAutocomplete.go
index 2d914fe..dc3efb4 100644
--- a/theMagicOfAutocomplete.go
+++ b/theMagicOfAutocomplete.go
@@ -9,6 +9,7 @@ import (
"strings"
"time"
+ "go.wit.com/lib/cobol"
"go.wit.com/lib/config"
"go.wit.com/log"
durationpb "google.golang.org/protobuf/types/known/durationpb"
@@ -35,7 +36,7 @@ func Autocomplete(dest any) *Argv {
all := NewArgvs()
// initializes the application config file
- config.Init(me.ARGNAME, me.VERSION, me.BUILDTIME, me.pb.Real)
+ config.Init(me.ARGNAME, me.VERSION, cobol.Time(me.BUILDTIME), me.pb.Real)
// loads the autocomplete history file
err := config.LoadCache(all, "argv", me.ARGNAME) //