1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package argvpb
// initializes logging and command line options
import (
"fmt"
"os"
"go.wit.com/lib/cobol"
"go.wit.com/log"
)
// returns the name of the executable registered for shell autocomplete
func GetAPPNAME() string {
return me.pb.AppInfo.APPNAME
}
func (pb *Argv) Version() string {
return pb.AppInfo.getVersion()
}
func doVersion(pb *Argv) {
log.Info(pb.AppInfo.getVersion())
os.Exit(0)
}
func (info *App) getVersion() string {
var s string
timeString, t, err := cobol.TimeCheck(info.BUILDTIME)
if t != nil {
// log.Printf("TIME getVersion(t != nil) ERR=(%v) t=(%v) AppInfo.BUILTIME is=(%v)\n", err, t, info.BUILDTIME)
return fmt.Sprintf("%s %s Built on %s", info.APPNAME, info.VERSION, cobol.Time(t))
} else if err == nil {
s = fmt.Sprintf("%s %s Built on %s (argv.had(%s))", info.APPNAME, info.VERSION, timeString, info.BUILDTIME)
} else {
log.Printf("TIME getVersion() ERR=(%v) timeString=(%v) AppInfo.BUILTIME was=(%v)\n", err, timeString, info.BUILDTIME)
s = fmt.Sprintf("%s %s Built on raw(%v) (argv had %s)", info.APPNAME, info.VERSION, timeString, info.BUILDTIME)
}
return s
}
/*
func StandardVersion(APPNAME, VERSION, BUILDTIME string) string {
return fmt.Sprintf("%s %s Built on raw(%v) %s (from argv)", APPNAME, VERSION, BUILDTIME, cobol.Time(BUILDTIME))
}
*/
|