Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Version = "dev"
Version is set by goreleaser at build time.
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App wires CLI output and API access.
func (*App) RenderCurrentWeather ¶
func (a *App) RenderCurrentWeather(w *weathercli.CurrentWeather) error
RenderCurrentWeather outputs current weather in human or JSON format.
func (*App) RenderForecast ¶
func (a *App) RenderForecast(f *weathercli.Forecast) error
RenderForecast outputs forecast in human or JSON format.
func (*App) RenderLocations ¶
func (a *App) RenderLocations(locations []weathercli.Location) error
RenderLocations outputs location search results.
type Color ¶
type Color struct {
// contains filtered or unexported fields
}
Color wraps color output helpers.
type CurrentCmd ¶
type CurrentCmd struct {
Location string `arg:"" name:"location" help:"Location name (e.g. 'New York', 'London, UK')."`
}
CurrentCmd gets current weather.
type ForecastCmd ¶
type ForecastCmd struct {
Location string `arg:"" name:"location" help:"Location name (e.g. 'Paris', 'Tokyo, Japan')."`
Days int `help:"Number of forecast days (1-16)." default:"7"`
Hourly bool `help:"Show hourly forecast instead of daily."`
Hours int `help:"Number of hours for hourly forecast (1-384)." default:"24"`
}
ForecastCmd gets weather forecast.
type GlobalOptions ¶
type GlobalOptions struct {
BaseURL string `help:"Weather API base URL." env:"WEATHER_BASE_URL" default:"https://api.open-meteo.com/v1"`
GeoBaseURL string `help:"Geocoding API base URL." env:"WEATHER_GEO_BASE_URL" default:"https://geocoding-api.open-meteo.com/v1"`
Timeout time.Duration `help:"HTTP timeout." default:"10s"`
JSON bool `help:"Output JSON."`
NoColor bool `help:"Disable color output."`
Verbose bool `help:"Verbose logging."`
Version VersionFlag `name:"version" help:"Print version and exit."`
}
GlobalOptions are flags shared by all commands.
type Root ¶
type Root struct {
Global GlobalOptions `embed:""`
Current CurrentCmd `cmd:"" help:"Get current weather for a location."`
Forecast ForecastCmd `cmd:"" help:"Get weather forecast for a location."`
Search SearchCmd `cmd:"" help:"Search for location coordinates."`
}
Root defines the CLI command tree.
type SearchCmd ¶
type SearchCmd struct {
Query string `arg:"" name:"query" help:"Location search query."`
Limit int `help:"Max results (1-10)." default:"5"`
}
SearchCmd searches for locations.
type VersionFlag ¶
type VersionFlag string
VersionFlag is a custom kong flag for --version.
func (VersionFlag) BeforeApply ¶
BeforeApply prints the version and exits.
func (VersionFlag) Decode ¶
func (v VersionFlag) Decode(_ *kong.DecodeContext) error
Decode is a no-op for the boolean version flag.
func (VersionFlag) IsBool ¶
func (v VersionFlag) IsBool() bool
IsBool marks the version flag as boolean.
Click to show internal directories.
Click to hide internal directories.