Skip to content
Snippets Groups Projects
Commit 5d460652 authored by Silvan's avatar Silvan
Browse files

fix display version

parent 7d77b95f
No related branches found
No related tags found
No related merge requests found
CurrentVersion=0.1.0
CurrentVersion=0.1.1
Project=UnblockNeteaseMusic
Path="UnblockNeteaseMusic/version"
GitCommit=$(git rev-parse --short HEAD || echo unsupported)
......
......@@ -3,6 +3,7 @@ package config
import (
"UnblockNeteaseMusic/common"
"UnblockNeteaseMusic/utils"
"UnblockNeteaseMusic/version"
"flag"
"fmt"
"os"
......@@ -17,6 +18,7 @@ var (
CertFile = flag.String("c", "./server.crt", "specify server cert,such as : \"server.crt\"")
KeyFile = flag.String("k", "./server.key", "specify server cert key ,such as : \"server.key\"")
Mode = flag.Int("m", 1, "specify running mode(1:hosts) ,such as : \"1\"")
V = flag.Bool("v", false, "display version info")
)
func ValidParams() bool {
......@@ -28,6 +30,10 @@ func ValidParams() bool {
fmt.Printf("arg[%d]=%s\n", i, flag.Arg(i))
}
}
if *V {
fmt.Println(version.FullVersion())
return false
}
sources := strings.Split(strings.ToLower(*Source), ":")
if len(sources) < 1 {
fmt.Printf("source param invalid: %v \n", *Source)
......
......@@ -12,7 +12,7 @@ var (
)
func FullVersion() string {
return fmt.Sprintf("Version: %6s \nGit commit: %6s \nGo version: %6s \nBuild time: %6s \n",
return fmt.Sprintf("Version: %s \nGit commit: %s \nGo version: %s \nBuild time: %s \n",
Version, GitCommit, GoVersion, BuildTime)
}
func AppVersion() string {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment