summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
}