update at 2019-10-03 10:27:40 by ehlxr
This commit is contained in:
parent
635ac4a230
commit
ae6164c0ff
@ -40,6 +40,8 @@ var serverCmd = &cobra.Command{
|
||||
host := cmd.LocalFlags().Lookup("host").Value.String()
|
||||
port, _ := strconv.Atoi(cmd.LocalFlags().Lookup("port").Value.String())
|
||||
|
||||
printVersion()
|
||||
|
||||
if err := server.Start(host, port); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
|
@ -30,12 +30,12 @@ import (
|
||||
)
|
||||
|
||||
var versionTpl = `%s
|
||||
|
||||
Name: hc
|
||||
Version: %s
|
||||
BuildTime: %s
|
||||
GitCommit: %s
|
||||
GoVersion: %s
|
||||
|
||||
`
|
||||
|
||||
// versionCmd represents the version command
|
||||
@ -45,9 +45,13 @@ var versionCmd = &cobra.Command{
|
||||
Long: `
|
||||
Print version of jwt`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
printVersion()
|
||||
},
|
||||
}
|
||||
|
||||
func printVersion() {
|
||||
banner, _ := base64.StdEncoding.DecodeString(metadata.BannerBase64)
|
||||
fmt.Printf(versionTpl, banner, metadata.Version, metadata.BuildTime, metadata.GitCommit, metadata.GoVersion)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
Loading…
Reference in New Issue
Block a user