A terminal weather app that fetches current conditions, hourly forecasts, and daily forecasts from the Open-Meteo API.
- Current weather with temperature, humidity, wind, and conditions
- 24-hour hourly forecast with precipitation probability
- 3-day daily forecast
- City name lookup via geocoding
- Historical data export (CSV/JSON)
- Styled terminal output with lipgloss
go install github.com/lubasinkal/weather/cmd/weather@latestOr build from source:
git clone https://github.com/lubasinkal/weather.git
cd weather
go build -o weather ./cmd/weatherBy coordinates:
weather -lat -24.6282 -lon 25.9231By city name:
weather -city "Gaborone,Botswana"Hide hourly forecast:
weather -city "London" -hourly=falseExport past weather data for analysis:
# Daily data as CSV
weather -city "Gaborone" -export-historical \
-start-date 2024-01-01 -end-date 2024-01-31 \
-data-type daily -format csv
# Hourly data as JSON
weather -lat -24.6282 -lon 25.9231 -export-historical \
-start-date 2024-06-01 -end-date 2024-06-07 \
-data-type hourly -format json -output june_data.json| Flag | Values | Default |
|---|---|---|
-start-date |
YYYY-MM-DD | (required) |
-end-date |
YYYY-MM-DD | (required) |
-data-type |
hourly, daily |
hourly |
-format |
csv, json |
csv |
-output |
filename | auto-generated |
| Flag | Description |
|---|---|
-lat |
Latitude |
-lon |
Longitude |
-city |
City name (e.g., "Gaborone,Botswana") |
-hourly |
Show hourly forecast (default: true) |
-help |
Show help |
-export-historical |
Export historical data |
-start-date |
Start date for historical data |
-end-date |
End date for historical data |
-data-type |
hourly or daily |
-format |
csv or json |
-output |
Output filename |
├── cmd/weather/main.go # CLI entry point
├── internal/
│ ├── export/ # CSV/JSON export
│ ├── geocoding/ # City name → coordinates
│ └── weather/ # Open-Meteo API client
MIT