Add confirmation menu to removing cards as well
This commit is contained in:
parent
b58718b537
commit
6a24cd6546
@ -188,16 +188,3 @@ func addCards(cards []string, unique bool, count int64) error {
|
||||
storageDisconnect(client)
|
||||
return nil
|
||||
}
|
||||
|
||||
func askConfirmation(card *Card) bool {
|
||||
drawImage(card)
|
||||
|
||||
fmt.Println("Is this correct (y/n)?")
|
||||
|
||||
var char = 'x'
|
||||
for char != 'y' && char != 'n' {
|
||||
fmt.Scanf("%c\n", &char)
|
||||
}
|
||||
|
||||
return char == 'y'
|
||||
}
|
||||
|
||||
@ -308,3 +308,16 @@ func coloredValue(value float64) string {
|
||||
|
||||
return outputColor
|
||||
}
|
||||
|
||||
func askConfirmation(card *Card) bool {
|
||||
drawImage(card)
|
||||
|
||||
fmt.Println("Is this correct (y/n)?")
|
||||
|
||||
var char = 'x'
|
||||
for char != 'y' && char != 'n' {
|
||||
fmt.Scanf("%c\n", &char)
|
||||
}
|
||||
|
||||
return char == 'y'
|
||||
}
|
||||
|
||||
@ -103,6 +103,10 @@ func removeCards(cards []string, count int64) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if !askConfirmation(c) {
|
||||
continue
|
||||
}
|
||||
|
||||
if foil && c.SerraCountFoil == 1 && c.SerraCount == 0 || !foil && c.SerraCount == 1 && c.SerraCountFoil == 0 {
|
||||
coll.storageRemove(bson.M{"_id": c.ID})
|
||||
l.Infof("\"%s\" (%.2f%s) removed", c.Name, c.getValue(foil), getCurrency())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user