Documentation
¶
Index ¶
- func Execute(args []string) (err error)
- func ExitCode(err error) int
- func VersionString() string
- type CLI
- type CompletionCmd
- type ConfigCmd
- type ConfigPathCmd
- type ConfigSetCmd
- type ConfigShowCmd
- type CurrentCmd
- type DailyCmd
- type DailyGroup
- type ExitError
- type FavoritesAddCmd
- type FavoritesCmd
- type FavoritesListCmd
- type FavoritesRemoveCmd
- type ForecastCmd
- type HourlyCmd
- type RadarCmd
- type RootFlags
- type UVCmd
- type VersionCmd
- type WarningsCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VersionString ¶
func VersionString() string
Types ¶
type CLI ¶
type CLI struct {
RootFlags `embed:""`
Version kong.VersionFlag `help:"Print version and exit"`
Current CurrentCmd `cmd:"" name:"current" help:"Show current weather"`
Daily DailyCmd `cmd:"" name:"daily" help:"Show daily forecast"`
Hourly HourlyCmd `cmd:"" name:"hourly" help:"Show hourly forecast"`
ForecastCmd ForecastCmd `cmd:"" name:"forecast" help:"Show full weather forecast" aliases:"f"`
Radar RadarCmd `cmd:"" name:"radar" help:"Download radar animation frames"`
Warnings WarningsCmd `cmd:"" name:"warnings" help:"Show weather warnings"`
UV UVCmd `cmd:"" name:"uv" help:"Show UV index"`
Favorites FavoritesCmd `cmd:"" name:"favorites" help:"Manage saved locations"`
Config ConfigCmd `cmd:"" name:"config" help:"Manage configuration"`
VersionCmd VersionCmd `cmd:"" name:"version" help:"Print version"`
Completion CompletionCmd `cmd:"" name:"completion" help:"Generate shell completions"`
}
type CompletionCmd ¶
type CompletionCmd struct {
Shell string `arg:"" help:"Shell type (bash, zsh, fish)" enum:"bash,zsh,fish"`
}
CompletionCmd generates shell completions for kmi CLI
func (*CompletionCmd) Run ¶
func (c *CompletionCmd) Run() error
type ConfigCmd ¶
type ConfigCmd struct {
Show ConfigShowCmd `cmd:"" help:"Show current config"`
Set ConfigSetCmd `cmd:"" help:"Set a config value"`
Path ConfigPathCmd `cmd:"" help:"Show config file path"`
}
ConfigCmd manages CLI configuration
type ConfigPathCmd ¶
type ConfigPathCmd struct{}
ConfigPathCmd shows the config file path
func (*ConfigPathCmd) Run ¶
func (c *ConfigPathCmd) Run(flags *RootFlags) error
type ConfigSetCmd ¶
type ConfigSetCmd struct {
Key string `arg:"" help:"Config key (language, default_lat, default_lon, cache_ttl, no_color)"`
Value string `arg:"" help:"Value to set"`
}
ConfigSetCmd sets a configuration value
func (*ConfigSetCmd) Run ¶
func (c *ConfigSetCmd) Run(flags *RootFlags) error
type ConfigShowCmd ¶
type ConfigShowCmd struct{}
ConfigShowCmd displays current configuration
func (*ConfigShowCmd) Run ¶
func (c *ConfigShowCmd) Run(flags *RootFlags) error
type CurrentCmd ¶
type CurrentCmd struct {
Location string `arg:"" help:"Location (coords 'lat,lon', city name, or @favorite)" required:""`
}
CurrentCmd shows current weather conditions
func (*CurrentCmd) Run ¶
func (c *CurrentCmd) Run(flags *RootFlags) error
type DailyCmd ¶
type DailyCmd struct {
Location string `arg:"" help:"Location (coords 'lat,lon', city name, or @favorite)" required:""`
Days int `help:"Number of days to show" default:"7"`
}
DailyCmd shows daily weather forecast
type DailyGroup ¶
type DailyGroup struct {
Date time.Time
DayName string
AM *api.DailyForecast
PM *api.DailyForecast
}
DailyGroup represents AM/PM pair for same day
type FavoritesAddCmd ¶
type FavoritesAddCmd struct {
Name string `arg:"" help:"Name for the favorite (e.g., home, work)"`
Location string `arg:"" help:"Location (coords 'lat,lon', city name, or @existing_favorite)"`
}
FavoritesAddCmd adds a new favorite location
func (*FavoritesAddCmd) Run ¶
func (c *FavoritesAddCmd) Run(flags *RootFlags) error
type FavoritesCmd ¶
type FavoritesCmd struct {
List FavoritesListCmd `cmd:"" help:"List saved locations"`
Add FavoritesAddCmd `cmd:"" help:"Add a location"`
Remove FavoritesRemoveCmd `cmd:"" help:"Remove a location"`
}
FavoritesCmd manages saved locations
type FavoritesListCmd ¶
type FavoritesListCmd struct{}
FavoritesListCmd lists all saved favorite locations
func (*FavoritesListCmd) Run ¶
func (c *FavoritesListCmd) Run(flags *RootFlags) error
type FavoritesRemoveCmd ¶
type FavoritesRemoveCmd struct {
Name string `arg:"" help:"Name of favorite to remove"`
}
FavoritesRemoveCmd removes a saved favorite location
func (*FavoritesRemoveCmd) Run ¶
func (c *FavoritesRemoveCmd) Run(flags *RootFlags) error
type ForecastCmd ¶
type ForecastCmd struct {
Location string `arg:"" help:"Location (coords 'lat,lon', city name, or @favorite)" required:""`
}
ForecastCmd fetches and displays weather forecast
func (*ForecastCmd) Run ¶
func (c *ForecastCmd) Run(flags *RootFlags) error
Run executes the forecast command
type HourlyCmd ¶
type HourlyCmd struct {
Location string `arg:"" help:"Location (coords 'lat,lon', city name, or @favorite)" required:""`
Hours int `help:"Number of hours to show" default:"12"`
}
HourlyCmd shows hourly weather forecast
type RadarCmd ¶
type RadarCmd struct {
Location string `arg:"" help:"Location (coords, city, or @favorite)" required:""`
Output string `help:"Output directory" default:""`
Frames bool `help:"Save individual PNG frames instead of GIF" default:"false"`
Open bool `help:"Open file after download" default:"true"`
}
RadarCmd downloads and displays radar animation
type RootFlags ¶
type RootFlags struct {
JSON bool `help:"Output JSON to stdout" short:"j"`
Plain bool `help:"Output plain TSV (for scripting)"`
NoColor bool `help:"Disable colors" env:"NO_COLOR"`
Lang string `help:"Language (nl,fr,en,de)" default:"en" env:"KMI_LANG"`
NoCache bool `help:"Bypass cache"`
NoLimit bool `help:"Bypass rate limiting"`
Verbose bool `help:"Verbose output" short:"v"`
OutputDir string `help:"Image output directory" type:"path"`
}
type UVCmd ¶
type UVCmd struct {
Location string `arg:"" help:"Location (coords 'lat,lon', city name, or @favorite)" required:""`
}
UVCmd shows UV index for a location
type VersionCmd ¶
type VersionCmd struct{}
func (*VersionCmd) Run ¶
func (c *VersionCmd) Run() error
type WarningsCmd ¶
type WarningsCmd struct {
Location string `arg:"" help:"Location (coords, city, or @favorite)" required:""`
MinLevel int `help:"Minimum warning level (1-4)" default:"1"`
}
WarningsCmd shows weather warnings for a location
func (*WarningsCmd) Run ¶
func (c *WarningsCmd) Run(flags *RootFlags) error