Use user input

This commit is contained in:
Andrew Scott 2022-08-02 23:56:24 -04:00
parent 76a4785a0f
commit 1cc715522e
Signed by: a
GPG key ID: 3EB62D0BBB8DB381

View file

@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"strconv"
pb "codeberg.org/andcscott/weather-cli/proto"
)
@ -49,14 +50,16 @@ func getUnixTime(c pb.RouteGuideClient) int32 {
// Query SimplrWeather for historical data
func getHistoricalData(c pb.RouteGuideClient, app *Application) {
var lat, lon, year, month, day int32
var lat, lon int
lat, _ = strconv.Atoi(app.Config.Latitude)
lon, _ = strconv.Atoi(app.Config.Longitude)
res, err := c.GetHistoricalData(context.Background(), &pb.LocationDate{
Latitude: lat,
Longitude: lon,
Year: year,
Month: month,
Day: day,
Latitude: int32(lat),
Longitude: int32(lon),
Year: app.Config.Date.Year,
Month: app.Config.Date.Month,
Day: app.Config.Date.Day,
})
if err != nil {
fmt.Printf("Error getting historical data: %v", err)