Add flag --skip-open/-s to skip browser opening on start, closes #50
This commit is contained in:
parent
f62d47f856
commit
c6f0b4d1bc
@ -80,6 +80,7 @@ Application Options:
|
||||
--listen= HTTP server listen port (8080)
|
||||
--auth-user= HTTP basic auth user
|
||||
--auth-pass= HTTP basic auth password
|
||||
-s, --skip-open Skip browser open on start
|
||||
```
|
||||
|
||||
## Compile from source
|
||||
|
5
main.go
5
main.go
@ -25,6 +25,7 @@ var options struct {
|
||||
HttpPort uint `long:"listen" description:"HTTP server listen port" default:"8080"`
|
||||
AuthUser string `long:"auth-user" description:"HTTP basic auth user"`
|
||||
AuthPass string `long:"auth-pass" description:"HTTP basic auth password"`
|
||||
SkipOpen bool `short:"s" long:"skip-open" description:"Skip browser open on start"`
|
||||
}
|
||||
|
||||
var dbClient *Client
|
||||
@ -132,6 +133,10 @@ func openPage() {
|
||||
url := fmt.Sprintf("http://localhost:%v", options.HttpPort)
|
||||
fmt.Println("To view database open", url, "in browser")
|
||||
|
||||
if options.SkipOpen {
|
||||
return
|
||||
}
|
||||
|
||||
_, err := exec.Command("which", "open").Output()
|
||||
if err != nil {
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user