aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--go.mod5
-rw-r--r--go.sum2
-rw-r--r--main.go26
4 files changed, 34 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3086b1d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+wxcli
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..efffbca
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,5 @@
+module bnbl.io/wxcli
+
+go 1.13
+
+require bnbl.io/wx v0.1.0
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..5bc1432
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,2 @@
+bnbl.io/wx v0.1.0 h1:FNrthzkLcsbqupDmcBNil3cd+KA3TRmo+6fkjbXac3Y=
+bnbl.io/wx v0.1.0/go.mod h1:0oU9MUdR+IKQRitmtKTLG1bVQvaI00iVvmzqWlIhi0c=
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..fe8637f
--- /dev/null
+++ b/main.go
@@ -0,0 +1,26 @@
+package main
+
+import (
+ "context"
+ "fmt"
+ "strings"
+
+ "bnbl.io/wx/metar"
+)
+
+func main() {
+ var mc metar.Client
+ req := metar.NewRequest(
+ metar.StationString("KBOS KBED KOWD KORH"),
+ metar.HoursBeforeNow(4.0),
+ metar.MostRecentForEachStation(metar.MostRecentConstraint),
+ )
+ res, err := mc.GetMETARs(context.Background(), req)
+ if err != nil {
+ fmt.Printf("could not get metar: %v\n", err)
+ return
+ }
+ for _, m := range res.Data.METARs {
+ fmt.Printf("%s\n", strings.TrimSpace(m.RawText))
+ }
+}