handle non-bolt files without needing to reset terminal
This commit is contained in:
parent
82c105e8c3
commit
ae584be0b8
@ -41,8 +41,8 @@ func main() {
|
|||||||
currentFilename = databaseFile
|
currentFilename = databaseFile
|
||||||
db, err = bolt.Open(databaseFile, 0600, nil)
|
db, err = bolt.Open(databaseFile, 0600, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error reading file: %q\n", err.Error())
|
mainLoop(nil, style)
|
||||||
os.Exit(1)
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// First things first, load the database into memory
|
// First things first, load the database into memory
|
||||||
|
@ -454,6 +454,12 @@ func (screen *BrowserScreen) moveCursorDown() bool {
|
|||||||
func (screen *BrowserScreen) performLayout() {}
|
func (screen *BrowserScreen) performLayout() {}
|
||||||
|
|
||||||
func (screen *BrowserScreen) drawScreen(style Style) {
|
func (screen *BrowserScreen) drawScreen(style Style) {
|
||||||
|
if screen.db == nil {
|
||||||
|
screen.drawHeader(style)
|
||||||
|
screen.setMessage("Invalid DB. Press 'q' to quit, '?' for help")
|
||||||
|
screen.drawFooter(style)
|
||||||
|
return
|
||||||
|
}
|
||||||
if len(screen.db.buckets) == 0 && screen.mode&modeInsertBucket != modeInsertBucket {
|
if len(screen.db.buckets) == 0 && screen.mode&modeInsertBucket != modeInsertBucket {
|
||||||
// Force a bucket insert
|
// Force a bucket insert
|
||||||
screen.startInsertItemAtParent(typeBucket)
|
screen.startInsertItemAtParent(typeBucket)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user