mirror of
https://codeberg.org/andyscott/weather-cli.git
synced 2024-11-08 05:50:51 -05:00
Use user input
This commit is contained in:
parent
76a4785a0f
commit
1cc715522e
1 changed files with 9 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue