Add -v flag to print current version
This commit is contained in:
parent
e80b90710b
commit
19f7c494e9
6
main.go
6
main.go
@ -13,6 +13,7 @@ import (
|
|||||||
const VERSION = "0.1.0"
|
const VERSION = "0.1.0"
|
||||||
|
|
||||||
var options struct {
|
var options struct {
|
||||||
|
Version bool `short:"v" description:"Print version"`
|
||||||
Debug bool `short:"d" description:"Enable debugging mode" default:"false"`
|
Debug bool `short:"d" description:"Enable debugging mode" default:"false"`
|
||||||
Url string `long:"url" description:"Database connection string"`
|
Url string `long:"url" description:"Database connection string"`
|
||||||
Host string `long:"host" description:"Server hostname or IP" default:"localhost"`
|
Host string `long:"host" description:"Server hostname or IP" default:"localhost"`
|
||||||
@ -72,6 +73,11 @@ func initOptions() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if options.Version {
|
||||||
|
fmt.Printf("pgweb v%s\n", VERSION)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func startServer() {
|
func startServer() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user