add main.Version

This commit is contained in:
ShuheiKubota 2019-11-09 15:29:48 +09:00
parent 200a67cd7b
commit beaa07bf03
1 changed files with 11 additions and 1 deletions

12
vvin.go
View File

@ -6,6 +6,7 @@ import (
"os" "os"
"strings" "strings"
"syscall" "syscall"
"time"
"unsafe" "unsafe"
"github.com/mitchellh/go-ps" "github.com/mitchellh/go-ps"
@ -13,6 +14,15 @@ import (
"github.com/shu-go/rog" "github.com/shu-go/rog"
) )
// Version is app version
var Version string
func init() {
if Version == "" {
Version = "dev-" + time.Now().Format("20060102")
}
}
type globalCmd struct { type globalCmd struct {
Target string `cli:"target,t=WINDOW_TITLE" help:"default to current window"` Target string `cli:"target,t=WINDOW_TITLE" help:"default to current window"`
Debug bool Debug bool
@ -159,7 +169,7 @@ func main() {
app := gli.NewWith(&globalCmd{}) app := gli.NewWith(&globalCmd{})
app.Name = "vvin" app.Name = "vvin"
app.Desc = "" app.Desc = ""
app.Version = "0.0.0" app.Version = Version
app.Usage = `` app.Usage = ``
app.Copyright = "(C) 2019 Shuhei Kubota" app.Copyright = "(C) 2019 Shuhei Kubota"
app.Run(os.Args) app.Run(os.Args)