mirror of
https://codeberg.org/andyscott/weather-cli.git
synced 2024-11-09 06:00:52 -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"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
pb "codeberg.org/andcscott/weather-cli/proto"
|
pb "codeberg.org/andcscott/weather-cli/proto"
|
||||||
)
|
)
|
||||||
|
@ -49,14 +50,16 @@ func getUnixTime(c pb.RouteGuideClient) int32 {
|
||||||
// Query SimplrWeather for historical data
|
// Query SimplrWeather for historical data
|
||||||
func getHistoricalData(c pb.RouteGuideClient, app *Application) {
|
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{
|
res, err := c.GetHistoricalData(context.Background(), &pb.LocationDate{
|
||||||
Latitude: lat,
|
Latitude: int32(lat),
|
||||||
Longitude: lon,
|
Longitude: int32(lon),
|
||||||
Year: year,
|
Year: app.Config.Date.Year,
|
||||||
Month: month,
|
Month: app.Config.Date.Month,
|
||||||
Day: day,
|
Day: app.Config.Date.Day,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error getting historical data: %v", err)
|
fmt.Printf("Error getting historical data: %v", err)
|
||||||
|
|
Loading…
Reference in a new issue