mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-14 19:21:46 +03:00
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() {
|
||||
chunks := []string{fmt.Sprintf("Pgweb v%s", command.Version)}
|
||||
|
||||
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, " "))
|
||||
fmt.Println(command.VersionString())
|
||||
}
|
||||
|
||||
func startServer() {
|
||||
|
@ -1,5 +1,10 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
// Version is the current Pgweb application version
|
||||
Version = "0.11.12"
|
||||
@ -32,3 +37,19 @@ func init() {
|
||||
Info.BuildTime = BuildTime
|
||||
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…
Reference in New Issue
Block a user