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()
|
host := cmd.LocalFlags().Lookup("host").Value.String()
|
||||||
port, _ := strconv.Atoi(cmd.LocalFlags().Lookup("port").Value.String())
|
port, _ := strconv.Atoi(cmd.LocalFlags().Lookup("port").Value.String())
|
||||||
|
|
||||||
|
printVersion()
|
||||||
|
|
||||||
if err := server.Start(host, port); err != nil {
|
if err := server.Start(host, port); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -30,12 +30,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var versionTpl = `%s
|
var versionTpl = `%s
|
||||||
|
|
||||||
Name: hc
|
Name: hc
|
||||||
Version: %s
|
Version: %s
|
||||||
BuildTime: %s
|
BuildTime: %s
|
||||||
GitCommit: %s
|
GitCommit: %s
|
||||||
GoVersion: %s
|
GoVersion: %s
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
// versionCmd represents the version command
|
// versionCmd represents the version command
|
||||||
@ -45,11 +45,15 @@ var versionCmd = &cobra.Command{
|
|||||||
Long: `
|
Long: `
|
||||||
Print version of jwt`,
|
Print version of jwt`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
banner, _ := base64.StdEncoding.DecodeString(metadata.BannerBase64)
|
printVersion()
|
||||||
fmt.Printf(versionTpl, banner, metadata.Version, metadata.BuildTime, metadata.GitCommit, metadata.GoVersion)
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printVersion() {
|
||||||
|
banner, _ := base64.StdEncoding.DecodeString(metadata.BannerBase64)
|
||||||
|
fmt.Printf(versionTpl, banner, metadata.Version, metadata.BuildTime, metadata.GitCommit, metadata.GoVersion)
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(versionCmd)
|
rootCmd.AddCommand(versionCmd)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user