package cli import ( "database/sql" "fmt" "sevenkeys/database" "sevenkeys/logic" ) var ( cardStorageLocation database.CardStorageLocation selectedCardPrintingSearchLine string copiesInserted int ) func getInfoDisplay(info string) string { if info == "" { return "[EMPTY]" } return info } func showStorageInfo() { fmt.Println("STORAGE SETTINGS") storageBoxDisplay := getInfoDisplay(cardStorageLocation.StorageBox) sourceDisplay := getInfoDisplay(cardStorageLocation.Source) conditionDisplay := getInfoDisplay(cardStorageLocation.CardCondition) fmt.Println("Storage location:", storageBoxDisplay) fmt.Println("Source:", sourceDisplay) fmt.Println("Condition:", conditionDisplay) fmt.Print("\n") } func showCopiesInserted() { fmt.Println("Copies inserted:", copiesInserted) } func getStorageOptions() { cardStorageLocation.StorageBox = GetStringResponse("Storage box label:") cardStorageLocation.Source = GetStringResponse("Card source:") cardStorageLocation.CardCondition = GetStringResponse("Card condition:") } func insertSelectedCard(db *sql.DB) { if cardStorageLocation.CardPrintingId == "" { output = "No card selected, please [search] for a card printing." return } if cardStorageLocation.StorageBox == "" || cardStorageLocation.CardCondition == "" { getStorageOptions() } err := logic.StoreCard(db, cardStorageLocation) logic.Check(err) copiesInserted++ }