summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--weather.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/weather.go b/weather.go
index d55297b..f14ec38 100644
--- a/weather.go
+++ b/weather.go
@@ -4,7 +4,6 @@ package main
// TODO: decode weather type number
// TODO: split out met office specific stuff to separate module
// TODO: add other weather providers
-// TODO: add -v verbose flag to show all data
import (
"encoding/json"
@@ -58,7 +57,10 @@ type WeatherParams struct {
WT int // Weather Type
}
-var numdays = flag.Int("n", 2, "number of days to show")
+var (
+ numdays = flag.Int("n", 2, "number of days to show")
+ verbose = flag.Bool("v", false, "verbose: show all weather details")
+)
func main() {
var r Response
@@ -102,4 +104,7 @@ func main() {
func prettyWeather(t string, w WeatherParams) {
fmt.Printf("%s Type: %2d, Temp: %4.1f°C, Rain: %2d%%, Wind: %2.1fm/s\n", t, w.WT, w.T, w.PP, w.WS)
+ if *verbose {
+ fmt.Printf(" %+v\n", w)
+ }
}