diff options
author | Nick White <git@njw.name> | 2020-02-10 12:06:45 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-02-10 12:06:45 +0000 |
commit | 0e2d1c42c9b56e2676603aefe2dafdefa32b3d3a (patch) | |
tree | 583b69359e4f2fc8c5188e1619b9cd202a6cee91 | |
parent | 80b9bfa2c71ea971db2e71fab1641cf7e140336d (diff) | |
download | weather-0e2d1c42c9b56e2676603aefe2dafdefa32b3d3a.tar.bz2 weather-0e2d1c42c9b56e2676603aefe2dafdefa32b3d3a.zip |
Show weather code if no description is known
-rw-r--r-- | weather.go | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -236,7 +236,11 @@ func main() { for _, w := range weather { fmt.Printf("%s %s ", w.date, w.time) - fmt.Printf("%18s, Temp: %4.1f°C, ", TypeDescription[w.weathertype], w.temperature) + desc := TypeDescription[w.weathertype] + if desc == "" { + desc = fmt.Sprintf("%d", w.weathertype) + } + fmt.Printf("%18s, Temp: %4.1f°C, ", desc, w.temperature) fmt.Printf("Rain: %2d%%, Wind: %4.1fmph\n", w.precipitation, w.windspeed) if *verbose { fmt.Printf(" %+v\n", w) |