Allow the user to quit properly

This commit is contained in:
The Magician 2024-05-31 22:44:52 +01:00
parent 4018f26998
commit 7dba7e4649
2 changed files with 9 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package logic
import (
"database/sql"
"log"
"sevenkeys/database"
)
@ -12,6 +13,7 @@ func StoreCard(db *sql.DB, storageLocation database.CardStorageLocation) error {
}
storageLocation.Position = lastPosition + 1
log.Println(storageLocation.Position)
err = database.InsertCardStorageLocation(db, storageLocation)
if err != nil {

View File

@ -2,11 +2,10 @@ package main
import (
"fmt"
"os"
"sevenkeys/database"
"sevenkeys/logic"
"sevenkeys/logic/scryfall"
"github.com/inancgumus/screen"
)
func main() {
@ -45,8 +44,10 @@ func main() {
logic.Check(err)
for {
screen.Clear()
screen.MoveTopLeft()
/*
screen.Clear()
screen.MoveTopLeft()
*/
fmt.Println("Storage location:", storageBox)
fmt.Println("Source:", source)
@ -69,8 +70,9 @@ func main() {
case "r":
err = logic.StoreCard(db, storageLocation)
logic.Check(err)
case "q":
break
case "q":
os.Exit(0)
}
}
}