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