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)) } */