From e10337092f296e1859960faa9f9c9f315265d0f8 Mon Sep 17 00:00:00 2001 From: aerth Date: Tue, 4 Apr 2017 20:31:40 -0700 Subject: [PATCH] handle the case of single nonbolt file --- boltbrowser.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/boltbrowser.go b/boltbrowser.go index 36cdc48..4d02f89 100644 --- a/boltbrowser.go +++ b/boltbrowser.go @@ -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