summaryrefslogtreecommitdiff
path: root/complete.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-03 10:03:57 -0500
committerJeff Carr <[email protected]>2025-10-03 10:03:57 -0500
commit85885a09373e59c8a8ea0bfc015bee647182fd32 (patch)
treef68c244db528b9a3dd0eed804976e28ca1fde495 /complete.go
parent03358095a0687f3f8b6bbcfcf1f38b26b3b2732a (diff)
add Version() to return the stringv0.0.20
Diffstat (limited to 'complete.go')
-rw-r--r--complete.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/complete.go b/complete.go
index 5e404e0..bd9d46e 100644
--- a/complete.go
+++ b/complete.go
@@ -411,9 +411,18 @@ func doBash(argname string) {
os.Exit(0)
}
+func (pb *Auto) Version() string {
+ return pb.getVersion()
+}
+
func doVersion(pb *Auto) {
+ log.Info(pb.getVersion())
+ os.Exit(0)
+}
+
+func (pb *Auto) getVersion() string {
if myAuto.buildtime == nil {
- return
+ return "app doesn't have argv.BuildVersion()"
}
BUILDTIME, VERSION := myAuto.buildtime()
@@ -444,11 +453,9 @@ func doVersion(pb *Auto) {
// dur := time.Since(localTime)
// BUILDTIME = fmt.Sprintf("%s age(%v)", localTime.String(), , shell.FormatDuration(time.Since(localTime)))
stamp := log.Sprintf("Built %s Age(%s)", localTime.Format("2006-01-02 15:04"), shell.FormatDuration(time.Since(localTime)))
- log.Infof("%s %s %s\n", pb.Argname, VERSION, stamp)
- os.Exit(0)
+ return fmt.Sprintf("%s %s %s", pb.Argname, VERSION, stamp)
}
}
- log.Infof("%s %s Built on %s\n", pb.Argname, VERSION, BUILDTIME)
- os.Exit(0)
+ return fmt.Sprintf("%s %s Built on %s", pb.Argname, VERSION, BUILDTIME)
}