gfsmos/main.go

35 lines
597 B
Go
Raw Normal View History

2020-02-25 16:14:46 +00:00
package main
import (
"fmt"
2020-02-26 03:34:17 +00:00
"gitlab/tyrelsouza/gfsmos/noaa_client"
2020-02-25 16:14:46 +00:00
"log"
"os"
2020-02-25 21:29:43 +00:00
"strings"
2020-02-25 16:14:46 +00:00
cli "github.com/urfave/cli/v2"
)
func main() {
2020-02-26 03:34:17 +00:00
2020-02-25 16:14:46 +00:00
app := &cli.App{
2020-02-25 21:29:43 +00:00
Name: "GFS MOS",
Usage: "Parse NOAA's GFS MOS for a given airport",
2020-02-25 16:14:46 +00:00
Action: func(c *cli.Context) error {
2020-02-25 21:29:43 +00:00
airport := strings.ToUpper(c.Args().First())
if airport == "" {
return cli.NewExitError("please pass the airport's ICAO as an argument", 1)
}
2020-02-26 03:34:17 +00:00
api := noaa_client.New(airport)
pre := api.GetDataRaw()
fmt.Print(pre)
2020-02-25 16:14:46 +00:00
return nil
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}