Add individual commands for storage settings
This commit is contained in:
parent
845204320b
commit
8e0d3cc03f
|
@ -29,15 +29,21 @@ func MainCliLoop(db *sql.DB) {
|
||||||
command = GetStringResponse("SEVENKEYS $")
|
command = GetStringResponse("SEVENKEYS $")
|
||||||
|
|
||||||
switch command {
|
switch command {
|
||||||
case "quit":
|
case "q", "quit":
|
||||||
return
|
return
|
||||||
case "storage":
|
case "l", "location":
|
||||||
getStorageOptions()
|
cardStorageLocation.StorageBox = GetStringResponse("Storage location:")
|
||||||
break
|
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()
|
getSearchCriteria()
|
||||||
break
|
break
|
||||||
case "search":
|
case "s", "search":
|
||||||
getSearchOptions(db)
|
getSearchOptions(db)
|
||||||
|
|
||||||
var previousCardPrintingId = cardStorageLocation.CardPrintingId
|
var previousCardPrintingId = cardStorageLocation.CardPrintingId
|
||||||
|
@ -55,7 +61,7 @@ func MainCliLoop(db *sql.DB) {
|
||||||
copiesInserted = 0
|
copiesInserted = 0
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "insert":
|
case "i", "insert":
|
||||||
insertSelectedCard(db)
|
insertSelectedCard(db)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -40,12 +40,6 @@ func showCopiesInserted() {
|
||||||
fmt.Println("Copies inserted:", copiesInserted)
|
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) {
|
func insertSelectedCard(db *sql.DB) {
|
||||||
if cardStorageLocation.CardPrintingId == "" {
|
if cardStorageLocation.CardPrintingId == "" {
|
||||||
output = "No card selected, please [search] for a card printing."
|
output = "No card selected, please [search] for a card printing."
|
||||||
|
@ -53,7 +47,8 @@ func insertSelectedCard(db *sql.DB) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if cardStorageLocation.StorageBox == "" || cardStorageLocation.CardCondition == "" {
|
if cardStorageLocation.StorageBox == "" || cardStorageLocation.CardCondition == "" {
|
||||||
getStorageOptions()
|
cardStorageLocation.StorageBox = GetStringResponse("Storage location:")
|
||||||
|
cardStorageLocation.CardCondition = GetStringResponse("Card condition:")
|
||||||
}
|
}
|
||||||
|
|
||||||
err := logic.StoreCard(db, cardStorageLocation)
|
err := logic.StoreCard(db, cardStorageLocation)
|
||||||
|
|
Loading…
Reference in New Issue