diff options
Diffstat (limited to 'weather.go')
-rw-r--r-- | weather.go | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -1,10 +1,10 @@ package main +// BUG: need to allow choice of met-office source (-b 0 doesn't work how i thought it would) // TODO: allow free-text lookups of place names, rather than ids // TODO: convert metoffice windspeed to mph // TODO: split output into days // TODO: add -n flag to only output a certain number of days -// TODO: convert weather type number into a human-friendly string // TODO: human friendly dates import ( @@ -100,6 +100,16 @@ type WeatherParams struct { WT int // Weather Type } +// TODO: complete this mapping +var TypeDescription = map[int]string{ + 0: "Clear Sky", + 1: "Sunny", + 2: "Partly Cloudy", + 3: "Sunny Intervals", + 7: "Light Cloud", + 12: "Light Rain", +} + // Our prefered struct type Weather struct { date string @@ -217,7 +227,7 @@ func main() { for _, w := range weather { fmt.Printf("%s %s ", w.date, w.time) - fmt.Printf("Type: %2d, Temp: %4.1f°C, ", w.weathertype, w.temperature) + fmt.Printf("%15s, Temp: %4.1f°C, ", TypeDescription[w.weathertype], w.temperature) fmt.Printf("Rain: %2d%%, Wind: %4.1fmph\n", w.precipitation, w.windspeed) if *verbose { fmt.Printf(" %+v\n", w) |