Add -v flag to print current version
This commit is contained in:
parent
e80b90710b
commit
19f7c494e9
20
main.go
20
main.go
@ -13,13 +13,14 @@ import (
|
|||||||
const VERSION = "0.1.0"
|
const VERSION = "0.1.0"
|
||||||
|
|
||||||
var options struct {
|
var options struct {
|
||||||
Debug bool `short:"d" description:"Enable debugging mode" default:"false"`
|
Version bool `short:"v" description:"Print version"`
|
||||||
Url string `long:"url" description:"Database connection string"`
|
Debug bool `short:"d" description:"Enable debugging mode" default:"false"`
|
||||||
Host string `long:"host" description:"Server hostname or IP" default:"localhost"`
|
Url string `long:"url" description:"Database connection string"`
|
||||||
Port int `long:"port" description:"Server port" default:"5432"`
|
Host string `long:"host" description:"Server hostname or IP" default:"localhost"`
|
||||||
User string `long:"user" description:"Database user" default:"postgres"`
|
Port int `long:"port" description:"Server port" default:"5432"`
|
||||||
DbName string `long:"db" description:"Database name" default:"postgres"`
|
User string `long:"user" description:"Database user" default:"postgres"`
|
||||||
Ssl string `long:"ssl" description:"SSL option" default:"disable"`
|
DbName string `long:"db" description:"Database name" default:"postgres"`
|
||||||
|
Ssl string `long:"ssl" description:"SSL option" default:"disable"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var dbClient *Client
|
var dbClient *Client
|
||||||
@ -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