Establish connections using bookmark ID only (#619)
* Establish connections using bookmark ID only * Refactor specs * Extra tests * Fix homedir assertion for bookmarks path * Fix newline in the warning message * Check for bookmark file existence before reading * Connect code restructure
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/jackc/pgpassfile"
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -154,6 +155,13 @@ func ParseOptions(args []string) (Options, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if opts.BookmarksDir == "" {
|
||||
path, err := homedir.Dir()
|
||||
if err == nil {
|
||||
opts.BookmarksDir = filepath.Join(path, ".pgweb/bookmarks")
|
||||
}
|
||||
}
|
||||
|
||||
return opts, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user