Skip to content

lubasinkal/weather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather CLI

A terminal weather app that fetches current conditions, hourly forecasts, and daily forecasts from the Open-Meteo API.

Features

  • 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

Install

go install github.com/lubasinkal/weather/cmd/weather@latest

Or build from source:

git clone https://github.com/lubasinkal/weather.git
cd weather
go build -o weather ./cmd/weather

Usage

By coordinates:

weather -lat -24.6282 -lon 25.9231

By city name:

weather -city "Gaborone,Botswana"

Hide hourly forecast:

weather -city "London" -hourly=false

Historical Data Export

Export 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

Export Options

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

All Flags

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

Project Structure

├── cmd/weather/main.go      # CLI entry point
├── internal/
│   ├── export/              # CSV/JSON export
│   ├── geocoding/           # City name → coordinates
│   └── weather/             # Open-Meteo API client

License

MIT

About

Weathe CLI

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages