Improve UI
This commit is contained in:
parent
a5934a1d9f
commit
1ab69e8980
|
@ -6,6 +6,8 @@ import (
|
|||
"sevenkeys/database"
|
||||
"sevenkeys/logic"
|
||||
"sevenkeys/logic/scryfall"
|
||||
|
||||
"github.com/inancgumus/screen"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -51,15 +53,18 @@ func main() {
|
|||
|
||||
var selectedCardId int
|
||||
var selectedCardSearchOption string = "None"
|
||||
var lastOutput string
|
||||
for {
|
||||
/*
|
||||
screen.Clear()
|
||||
screen.MoveTopLeft()
|
||||
*/
|
||||
screen.Clear()
|
||||
screen.MoveTopLeft()
|
||||
|
||||
fmt.Println("Storage location:", storageBox, "|", "Source:", source)
|
||||
fmt.Println("Selected card:", selectedCardSearchOption, "ID:", selectedCardId)
|
||||
|
||||
if lastOutput != "" {
|
||||
fmt.Println(lastOutput)
|
||||
}
|
||||
|
||||
var action string
|
||||
action = logic.GetResponse("[s]earch for card/[i]nsert selected card/[q]uit:")
|
||||
switch action {
|
||||
|
@ -68,25 +73,26 @@ func main() {
|
|||
logic.Check(err)
|
||||
|
||||
storageLocation.CardPrintingId = selectedCardId
|
||||
lastOutput = ""
|
||||
|
||||
continue
|
||||
case "i":
|
||||
if selectedCardId == 0 {
|
||||
fmt.Println("No selected card, please search for one.")
|
||||
lastOutput = "No selected card, please search for one."
|
||||
continue
|
||||
}
|
||||
|
||||
err = logic.StoreCard(db, storageLocation)
|
||||
logic.Check(err)
|
||||
|
||||
lastOutput = "Inserted card: " + selectedCardSearchOption
|
||||
|
||||
break
|
||||
case "q":
|
||||
os.Exit(0)
|
||||
default:
|
||||
fmt.Println("Not a valid command:", action)
|
||||
lastOutput = "Not a valid command: " + action
|
||||
break
|
||||
}
|
||||
|
||||
fmt.Print("\n\n")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue