blob: c5008be6729ab68f39d598a64286e0e0e0edd153 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// main.go - Main application entry point
package main
import (
"encoding/json"
"flag"
"fmt"
"os"
)
func main() {
location := flag.String("place", "Helsinki", "Location for the forecast")
flag.Parse()
// Create client and get forecast
client := NewFMIClient()
response, err := client.GetForecast(*location)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
// Output JSON
jsonData, err := json.MarshalIndent(response, "", " ")
if err != nil {
fmt.Fprintf(os.Stderr, "Error marshaling JSON: %v\n", err)
os.Exit(1)
}
fmt.Println(string(jsonData))
}
|