Add individual commands for storage settings

This commit is contained in:
The Magician 2024-06-14 10:50:46 +01:00
parent 845204320b
commit 8e0d3cc03f
2 changed files with 14 additions and 13 deletions

View File

@ -29,15 +29,21 @@ func MainCliLoop(db *sql.DB) {
command = GetStringResponse("SEVENKEYS $")
switch command {
case "quit":
case "q", "quit":
return
case "storage":
getStorageOptions()
case "l", "location":
cardStorageLocation.StorageBox = GetStringResponse("Storage location:")
break
case "criteria":
case "r", "source":
cardStorageLocation.Source = GetStringResponse("Card source:")
break
case "n", "condition":
cardStorageLocation.CardCondition = GetStringResponse("Card condition:")
break
case "c", "criteria":
getSearchCriteria()
break
case "search":
case "s", "search":
getSearchOptions(db)
var previousCardPrintingId = cardStorageLocation.CardPrintingId
@ -55,7 +61,7 @@ func MainCliLoop(db *sql.DB) {
copiesInserted = 0
}
break
case "insert":
case "i", "insert":
insertSelectedCard(db)
break
default:

View File

@ -40,12 +40,6 @@ 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."
@ -53,7 +47,8 @@ func insertSelectedCard(db *sql.DB) {
}
if cardStorageLocation.StorageBox == "" || cardStorageLocation.CardCondition == "" {
getStorageOptions()
cardStorageLocation.StorageBox = GetStringResponse("Storage location:")
cardStorageLocation.CardCondition = GetStringResponse("Card condition:")
}
err := logic.StoreCard(db, cardStorageLocation)