master
Simon Kellet 3 years ago
parent 14f7396e22
commit e814e7b9ea
  1. 15
      README.md
  2. BIN
      go-weather
  3. 7
      main.go

@ -9,21 +9,20 @@ You will need a OpenWeather API-Key. This can be done by opening a free account
./go-weather -h
```
Will give:
```
Usage of go-weather:
```text
Usage of ./go-weather:
-api string
Enter Code e.g. uk, us etc... Default(none) (default "none")
Enter you api key here (default "none")
-city string
Enter city e.g. London, Glasgow etc... (Default: London) (default "London")
Enter city e.g. London (default "London")
-code string
Enter Code e.g. uk, us etc... (Default: uk) (default "uk")
Enter Code e.g. uk (default "uk")
```
Running the command in a terminal like so:
```
./go-weather -api=API-KEY -city=Glasgow -code=uk
```
Will give:
**Will give:**
```
02/17/2022 17:03
📍Location: Glasgow, GB

Binary file not shown.

@ -76,9 +76,9 @@ type Sys struct {
func main() {
//set up the flags for the program to use!
var city, code, api_key string
flag.StringVar(&city, "city", "London", "Enter city e.g. London, Glasgow etc... (Default: London)")
flag.StringVar(&code, "code", "uk", "Enter Code e.g. uk, us etc... (Default: uk)")
flag.StringVar(&api_key, "api", "none", "Enter you api key here... (Default: none")
flag.StringVar(&city, "city", "London", "Enter city e.g. London")
flag.StringVar(&code, "code", "uk", "Enter Code e.g. uk")
flag.StringVar(&api_key, "api", "none", "Enter you api key here")
flag.Parse()
full := "https://api.openweathermap.org/data/2.5/weather?q=" + city + "," + code + "&units=metric" + "&appid=" + api_key + ""
@ -88,7 +88,6 @@ func main() {
//Create file
createFile(string(html), false)
//Load the file
data, _ := loadJson("weather.json")

Loading…
Cancel
Save