// $TheSupernovaDuo: yuuka,v 0.1.1 2023/5/29 18:19:14 yakumo_izuru Exp $ package main import ( "log" "github.com/integrii/flaggy" ) var ( format string = "AT" region string lang string = "en" ) func main() { flaggy.SetDescription("Yuuka is yet another client for wttr.in") flaggy.SetVersion(FullVersion()) forecastCmd := flaggy.NewSubcommand("forecast") forecastCmd.String(&format, "f", "format", "View options") forecastCmd.String(®ion, "r", "region", "Where to look at") forecastCmd.String(&lang, "l", "language", "Set preferred language") forecastCmd.Description = "Check the current forecast of an specific location" moonCmd := flaggy.NewSubcommand("moon") moonCmd.String(&format, "f", "format", "View options") moodCmd.String(&lang, "l", "language", "Set preferred language") moonCmd.Description = "See what's going on at the Moon" flaggy.AttachSubcommand(forecastCmd, 1) flaggy.AttachSubcommand(moonCmd, 1) flaggy.Parse() if forecastCmd.Used { ShowForecast(region, format, lang) } else if moonCmd.Used { ShowMoonPhases(format, lang) } else { flaggy.ShowHelpAndExit("A subcommand is required") } } func sanityCheck(err error) { if err != nil { log.Fatal(err) } }