From ce9240d82c265da10655f982b77f0fc62aa3836e Mon Sep 17 00:00:00 2001 From: Thomas Schwery Date: Fri, 1 Dec 2017 07:48:58 +0100 Subject: [PATCH] Display a different color for buy and sell orders in market overview --- main.go | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/main.go b/main.go index fbfd771..3adda6d 100644 --- a/main.go +++ b/main.go @@ -470,7 +470,7 @@ func printClonesInformation(swaggerclient *ESI.App, m *Character) string { for _, clone := range clones { sInfo, sErr := getStructureStationInfo(swaggerclient, clone.LocationID) if sErr != nil { - fmt.Printf("Error on structure information read on structure %s\n", clone.LocationID) + fmt.Printf("Error on structure information read on structure %d\n", clone.LocationID) log.Fatalf("Got error on getStructureStationInfo: %T %s", sErr, sErr) } @@ -714,19 +714,9 @@ func printCharacterMarketOrders(swaggerclient *ESI.App, m *Character) string { remainingAmount := *order.Price * float32(*order.VolumeRemain) remainingDuration := expirationDate.Sub(time.Now()) - buySellStatus := "↟" + buySellStatus := aurora.Green("↟").Bold() if *order.IsBuyOrder { - buySellStatus = "↡" - } - - var status string - - if remainingDuration.Hours() <= 0 { - status = fmt.Sprint(aurora.Red(buySellStatus).Bold()) - } else if remainingDuration.Hours() <= 72 { - status = fmt.Sprint(aurora.Magenta(buySellStatus).Bold()) - } else { - status = fmt.Sprint(aurora.Green(buySellStatus).Bold()) + buySellStatus = aurora.Magenta("↡").Bold() } duration := fmt.Sprintf("%d/%d", remainingDuration/time.Hour/24, *order.Duration) @@ -751,12 +741,12 @@ func printCharacterMarketOrders(swaggerclient *ESI.App, m *Character) string { sInfo, sErr := getStructureStationInfo(swaggerclient, int64(*order.LocationID)) if sErr != nil { - fmt.Printf("Error on structure information read on structure %s\n", order.LocationID) + fmt.Printf("Error on structure information read on structure %d\n", order.LocationID) log.Fatalf("Got error on getStructureStationInfo: %T %s", sErr, sErr) } line := fmt.Sprintf(" %s % 25.25s ISK % 13s ISK % 13s (%s) (%s) %s", - status, + buySellStatus, pinNames[*order.TypeID], ac.FormatMoney(*order.Price), ac.FormatMoney(remainingAmount), @@ -846,7 +836,7 @@ func printCharacterIndustryJobs(swaggerclient *ESI.App, m *Character) string { sInfo, sErr := getStructureStationInfo(swaggerclient, int64(*job.FacilityID)) if sErr != nil { - fmt.Printf("Error on structure information read on structure %s\n", *job.FacilityID) + fmt.Printf("Error on structure information read on structure %d\n", *job.FacilityID) log.Fatalf("Got error on getStructureStationInfo: %T %s", sErr, sErr) }