handle the case of single nonbolt file

This commit is contained in:
aerth 2017-04-04 20:31:40 -07:00
parent ae584be0b8
commit e10337092f
No known key found for this signature in database
GPG Key ID: EBC461F686385D5C
1 changed files with 8 additions and 3 deletions

View File

@ -32,7 +32,6 @@ func main() {
panic(err)
}
defer termbox.Close()
style := defaultStyle()
termbox.SetOutputMode(termbox.Output256)
@ -41,8 +40,14 @@ func main() {
currentFilename = databaseFile
db, err = bolt.Open(databaseFile, 0600, nil)
if err != nil {
mainLoop(nil, style)
continue
if len(databaseFiles) > 1 {
mainLoop(nil, style)
continue
} else {
termbox.Close()
fmt.Printf("Error reading file: %q\n", err.Error())
os.Exit(111)
}
}
// First things first, load the database into memory