mirror of
https://codeberg.org/andyscott/weather-cli.git
synced 2024-11-09 06:00:52 -05:00
Move printing data to separate file
This commit is contained in:
parent
a3ad072a0f
commit
7d59138191
1 changed files with 25 additions and 0 deletions
25
cmd/client/render.go
Normal file
25
cmd/client/render.go
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// Prints saved weather data to the terminal
|
||||||
|
func printWeather(app *application) {
|
||||||
|
|
||||||
|
var unitStr string
|
||||||
|
if app.Config.Units == "imperial" {
|
||||||
|
unitStr = "Farhenheit/mph"
|
||||||
|
} else {
|
||||||
|
unitStr = "Celsius/kph"
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("\nNote! A value of 0 or 0.00 indicates the data is not available at this time.")
|
||||||
|
fmt.Printf("Units: %s (%s)\n\n", app.Config.Units, unitStr)
|
||||||
|
fmt.Printf("Current temperature: %.2f\n", app.Forecast.Main.Temp)
|
||||||
|
fmt.Printf("Feels like: %.2f\n", app.Forecast.Main.FeelsLike)
|
||||||
|
fmt.Printf("High: %.2f\n", app.Forecast.Main.HighTemp)
|
||||||
|
fmt.Printf("Low: %.2f\n", app.Forecast.Main.LowTemp)
|
||||||
|
fmt.Printf("Pressure (hPa): %d\n", app.Forecast.Main.Pressure)
|
||||||
|
fmt.Printf("Humidty (%%): %d\n", app.Forecast.Main.Humidity)
|
||||||
|
fmt.Printf("Wind speed: %.2f\n", app.Forecast.Wind.Speed)
|
||||||
|
fmt.Printf("Gust: %.2f\n", app.Forecast.Wind.Gust)
|
||||||
|
}
|
Loading…
Reference in a new issue