diff options
author | Nick White <git@njw.name> | 2021-02-05 15:12:14 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2021-02-05 15:20:07 +0000 |
commit | b2bb70e0a13f459e6b50c075e1be44309ba48918 (patch) | |
tree | af5240623e5aee80f7e48f66354e435320694f5e /weather.go | |
parent | e346933cf5f3e2a652e89f3a3467c569b0330291 (diff) | |
download | weather-b2bb70e0a13f459e6b50c075e1be44309ba48918.tar.bz2 weather-b2bb70e0a13f459e6b50c075e1be44309ba48918.zip |
Add README and usage
Diffstat (limited to 'weather.go')
-rw-r--r-- | weather.go | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -17,6 +17,12 @@ const bbcdefid = "2654675" const meturl = "https://www.metoffice.gov.uk/public/data/PWSCache/BestForecast/Forecast/%s.json?concise=true" const bbcurl = "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/aggregated/%s" +const usage = `Usage: weather [-s source] [-v] [locationid] + +weather shows the weather forecast for a location. Read the README +for instructions on finding your location ID. +` + const mpsToMphMultiplier = 2.23693629 // BBC structures @@ -143,7 +149,6 @@ type Weather struct { var ( src = flag.String("s", "bbc", "data source provider (valid options: 'bbc', 'metoffice')") - numdays = flag.Int("n", 2, "number of days to show") verbose = flag.Bool("v", false, "verbose: show all weather details") ) @@ -217,6 +222,10 @@ func main() { var resp *http.Response var weather []Weather + flag.Usage = func() { + fmt.Fprintf(flag.CommandLine.Output(), usage) + flag.PrintDefaults() + } flag.Parse() switch *src { |