summaryrefslogtreecommitdiff
path: root/weather.go
diff options
context:
space:
mode:
Diffstat (limited to 'weather.go')
-rw-r--r--weather.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/weather.go b/weather.go
index 8325c41..25142cd 100644
--- a/weather.go
+++ b/weather.go
@@ -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)