EVEN BETTER

master
Simon Kellet 2 years ago
parent 8ff19a6e56
commit c13535379f
  1. BIN
      go-weather
  2. 14
      main.go

Binary file not shown.

@ -161,12 +161,12 @@ func iconToEmoji(icon string) {
func printWeather(data WeatherAPI) {
weatherData := data
dt := time.Now()
fmt.Println(dt.Format("01/02/2006 15:04"))
white := color.New(color.FgWhite)
boldWhite := white.Add(color.Bold)
dt := time.Now()
boldWhite.Println(dt.Format("01/02/2006 15:04"))
str_loc := weatherData.Name
str_code := weatherData.Sys.Country
str_weather := weatherData.Weather[0].Main
@ -179,15 +179,15 @@ func printWeather(data WeatherAPI) {
str_sunset := time.Unix(weatherData.Sys.Sunset, 0)
str_sunrise := time.Unix(weatherData.Sys.Sunrise, 0)
boldWhite.Printf("Location: ")
boldWhite.Printf("📍Location: ")
fmt.Printf("%v, %v\n", str_loc, str_code)
boldWhite.Printf("Weather:")
iconToEmoji(str_weather_icon)
fmt.Printf(" %v (%v)\n", str_weather, str_weather_detail)
boldWhite.Printf("Temp: ")
boldWhite.Printf("🌡 Temp: ")
fmt.Printf("%v°C (Feels like: %v°C)\n(Min: %v°C, Max: %v°C)\n", str_temp, str_temp_fl, str_temp_min, str_temp_max)
boldWhite.Printf("Sunrise: ")
boldWhite.Printf("🌅Sunrise: ")
fmt.Printf("%v\t", str_sunrise.Format("15:04"))
boldWhite.Printf("Sunset: ")
boldWhite.Printf("🌇Sunset: ")
fmt.Printf("%v\n", str_sunset.Format("15:04"))
}

Loading…
Cancel
Save