A simple, colorized command-line weather checker written in Go.
- Get current weather for any city
- Displays temperature, feels-like, humidity, wind speed and advice based on conditions
- Unicode weather icons and colorized terminal output for clarity
-
Clone this repository
git clone https://github.com/myntdeveloper/weather-cli.git cd weather-cli -
Set the API key
Get your API key from OpenWeatherMap and set it as an environment variable.
Example:export WEATHER_API_KEY=your_api_key(You must set this environment variable before running the CLI.)
-
Build the binary
go build -o weather ./cmd
-
Get weather for a city
./weather -city London
(By default, the city is set to "Tokyo" if you don't provide the flag.)
WEATHER_API_KEY=your_api_key| Flag | Description | Default |
|---|---|---|
-city |
City to check weather for | Tokyo |
When you run:
./weather -city MoscowYou might see output like:
weather-cli/
├── cmd/
│ └── main.go # Entrypoint, CLI logic
├── internal/
│ ├── commands/ # CLI command handling
│ │ └── root.go
│ └── logic/ # Core logic (fetching, models, pretty print)
│ ├── models.go
│ └── weather.go
├── go.mod
└── README.md
- Go 1.19 or newer
- OpenWeatherMap API key
Built with ❤️ by mynt