TheMathemagicians/sevenkeys/main.go

66 lines
1.3 KiB
Go
Raw Normal View History

2024-05-28 14:29:13 +00:00
package main
import (
2024-06-10 15:34:16 +00:00
"sevenkeys/cli"
2024-06-10 12:32:45 +00:00
"sevenkeys/database"
2024-06-10 15:34:16 +00:00
"sevenkeys/figlet"
2024-05-28 14:29:13 +00:00
)
func main() {
2024-06-10 15:34:16 +00:00
db := database.GetDatabaseFromConfig("config.json")
figlet.ReadFigletFonts()
2024-06-10 12:32:45 +00:00
2024-06-10 15:34:16 +00:00
cli.ShowSplashScreen()
2024-06-10 12:32:45 +00:00
2024-06-10 15:34:16 +00:00
cli.RunUpdateCheck(db)
2024-05-28 14:29:13 +00:00
2024-06-11 09:57:02 +00:00
cli.MainCliLoop(db)
2024-05-30 13:32:04 +00:00
2024-06-10 15:34:16 +00:00
/*
2024-06-05 12:06:24 +00:00
var selectedCardId string
var selectedCardSearchOption string = "None"
var lastOutput string
for {
screen.Clear()
screen.MoveTopLeft()
2024-06-01 21:18:33 +00:00
2024-06-05 12:06:24 +00:00
fmt.Println("Storage location:", storageBox, "|", "Source:", source)
fmt.Println("Selected card:", selectedCardSearchOption, "ID:", selectedCardId)
if lastOutput != "" {
fmt.Println(lastOutput)
2024-06-01 21:18:33 +00:00
}
2024-06-05 12:06:24 +00:00
var action string
action = logic.GetResponse("[s]earch for card/[i]nsert selected card/[q]uit:")
switch action {
case "s":
selectedCardId, selectedCardSearchOption, err = logic.Search(searchOptions)
logic.Check(err)
2024-06-01 21:18:33 +00:00
2024-06-05 12:06:24 +00:00
storageLocation.CardPrintingId = selectedCardId
lastOutput = ""
2024-06-01 21:54:15 +00:00
2024-06-05 12:06:24 +00:00
continue
case "i":
if selectedCardId == "" {
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:
lastOutput = "Not a valid command: " + action
break
}
}
2024-06-05 12:06:24 +00:00
*/
2024-05-28 14:29:13 +00:00
}