Add VersionString func to print out full app version
This commit is contained in:
parent
3e1a93296e
commit
97e41fbfe5
@ -176,21 +176,7 @@ func initOptions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func printVersion() {
|
func printVersion() {
|
||||||
chunks := []string{fmt.Sprintf("Pgweb v%s", command.Version)}
|
fmt.Println(command.VersionString())
|
||||||
|
|
||||||
if command.GitCommit != "" {
|
|
||||||
chunks = append(chunks, fmt.Sprintf("(git: %s)", command.GitCommit))
|
|
||||||
}
|
|
||||||
|
|
||||||
if command.GoVersion != "" {
|
|
||||||
chunks = append(chunks, fmt.Sprintf("(go: %s)", command.GoVersion))
|
|
||||||
}
|
|
||||||
|
|
||||||
if command.BuildTime != "" {
|
|
||||||
chunks = append(chunks, fmt.Sprintf("(build time: %s)", command.BuildTime))
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println(strings.Join(chunks, " "))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func startServer() {
|
func startServer() {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package command
|
package command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Version is the current Pgweb application version
|
// Version is the current Pgweb application version
|
||||||
Version = "0.11.12"
|
Version = "0.11.12"
|
||||||
@ -32,3 +37,19 @@ func init() {
|
|||||||
Info.BuildTime = BuildTime
|
Info.BuildTime = BuildTime
|
||||||
Info.GoVersion = GoVersion
|
Info.GoVersion = GoVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func VersionString() string {
|
||||||
|
chunks := []string{fmt.Sprintf("Pgweb v%s", Version)}
|
||||||
|
|
||||||
|
if GitCommit != "" {
|
||||||
|
chunks = append(chunks, fmt.Sprintf("(git: %s)", GitCommit))
|
||||||
|
}
|
||||||
|
if GoVersion != "" {
|
||||||
|
chunks = append(chunks, fmt.Sprintf("(go: %s)", GoVersion))
|
||||||
|
}
|
||||||
|
if BuildTime != "" {
|
||||||
|
chunks = append(chunks, fmt.Sprintf("(build time: %s)", BuildTime))
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(chunks, " ")
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user