Colored price history in card and set view
This commit is contained in:
parent
438d348483
commit
406a252d01
@ -73,9 +73,17 @@ func show_card_details(card *Card) error {
|
||||
fmt.Printf(" Scryfall: %s\n", strings.Replace(card.ScryfallURI, "?utm_source=api", "", 1))
|
||||
fmt.Printf(" Current Value: %s%.2f EUR%s\n", Yellow, card.Prices.Eur, Reset)
|
||||
fmt.Printf(" History:\n")
|
||||
var before float64
|
||||
for _, e := range card.SerraPrices {
|
||||
if e.Value > before {
|
||||
fmt.Printf(" * %s %s%.2f EUR%s\n", stringToTime(e.Date), Green, e.Value, Reset)
|
||||
} else if e.Value < before {
|
||||
fmt.Printf(" * %s %s%.2f EUR%s\n", stringToTime(e.Date), Red, e.Value, Reset)
|
||||
} else {
|
||||
fmt.Printf(" * %s %.2f EUR\n", stringToTime(e.Date), e.Value)
|
||||
}
|
||||
before = e.Value
|
||||
}
|
||||
fmt.Println()
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -289,8 +289,17 @@ func ShowSet(setname string) error {
|
||||
LogMessage(fmt.Sprintf("Uncommons: %.0f", uncommons), "normal")
|
||||
LogMessage(fmt.Sprintf("Commons: %.0f", commons), "normal")
|
||||
fmt.Printf("\n%sPrice History:%s\n", Pink, Reset)
|
||||
|
||||
var before float64
|
||||
for _, e := range sets[0].SerraPrices {
|
||||
fmt.Printf("* %s %.2f EUR\n", stringToTime(e.Date), e.Value)
|
||||
if e.Value > before {
|
||||
fmt.Printf("* %s %s%.2f EUR%s\n", stringToTime(e.Date), Green, e.Value, Reset)
|
||||
} else if e.Value < before {
|
||||
fmt.Printf("* %s %s%.2f EUR%s\n", stringToTime(e.Date), Red, e.Value, Reset)
|
||||
} else {
|
||||
fmt.Printf("* %s %.2f EUR%s\n", stringToTime(e.Date), e.Value)
|
||||
}
|
||||
before = e.Value
|
||||
}
|
||||
|
||||
fmt.Printf("\n%sMost valuable cards%s\n", Pink, Reset)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user