31 lines
523 B
Go
31 lines
523 B
Go
|
package cmd
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
"strings"
|
||
|
|
||
|
"git.apinb.com/bsm-sdk/engine/vars"
|
||
|
)
|
||
|
|
||
|
func NewCmd() {
|
||
|
if len(os.Args) > 1 {
|
||
|
parseArgs(os.Args[1])
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func parseArgs(cmd string) {
|
||
|
cmd = strings.ToLower(cmd)
|
||
|
switch cmd {
|
||
|
case "-v", "--v", "-version", "--version":
|
||
|
versionCmd()
|
||
|
}
|
||
|
|
||
|
os.Exit(0)
|
||
|
}
|
||
|
|
||
|
func versionCmd() {
|
||
|
fmt.Printf("[Blocks Service: %s] Version: %s \n", vars.ServiceKey, vars.VERSION)
|
||
|
fmt.Printf("[Blocks Service: %s] Compile: %s by %s build.\n", vars.ServiceKey, vars.GO_VERSION, vars.BUILD_TIME)
|
||
|
}
|