diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | go.mod | 5 | ||||
-rw-r--r-- | go.sum | 2 | ||||
-rw-r--r-- | main.go | 26 |
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 @@ -0,0 +1,5 @@ +module bnbl.io/wxcli + +go 1.13 + +require bnbl.io/wx v0.1.0 @@ -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= @@ -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)) + } +} |