Merge pull request #389 from sosedoff/fix-startup-with-default-db

Fix startup behavior when user did not provide a database name
This commit is contained in:
Dan Sosedoff 2018-11-27 17:32:16 -06:00 committed by GitHub
commit 420478ce6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,7 +77,18 @@ func initClient() {
fmt.Println("Connecting to server...")
err = cl.Test()
if err != nil {
exitWithMessage(err.Error())
msg := err.Error()
// Check if we're trying to connect to the default database.
// If database does not exist, allow user to connect from the UI.
if command.Opts.DbName == "" {
if strings.Contains(msg, "database") && strings.Contains(msg, "does not exist") {
fmt.Println("Error:", msg)
return
}
}
exitWithMessage(msg)
}
if !command.Opts.Sessions {