This is a simple CLI application that fetches and displays weather information for a specified location using the WeatherAPI.
- Go 1.24 or later
- An internet connection to fetch weather data from the WeatherAPI
- Clone the repository:
git clone https://github.com/Chu-rill/go-weather-cli.git
cd go-weather-cli
- Install dependencies:
go mod tidy
To build the project, run the following command:
go build -o go-weather-cli main.go
This will create an executable named go-weather-cli in the current directory.
To run the application, use the following command:
./go-weather-cli [location]
Replace [location] with the name of the location you want to fetch the weather for. If no location is provided, it defaults to "Abuja".
Example:
./go-weather-cli London
The application fetches weather data from the WeatherAPI and displays the current weather and hourly forecast for the specified location. The output includes temperature, chance of rain, and weather conditions. The output is colorized based on the chance of rain.
📍 Abuja, Nigeria: 🌡️ 25.0°C, ☁️ Sunny
📅 Hourly Forecast:
🕒 07:00 - 🌡️ 25.0°C, ☔ 0%, ☁️ Sunny
🕒 08:00 - 🌡️ 26.9°C, ☔ 0%, ☁️ Sunny
🕒 09:00 - 🌡️ 29.5°C, ☔ 0%, ☁️ Sunny
🕒 10:00 - 🌡️ 31.8°C, ☔ 0%, ☁️ Sunny
🕒 11:00 - 🌡️ 34.4°C, ☔ 0%, ☁️ Sunny
🕒 12:00 - 🌡️ 36.6°C, ☔ 0%, ☁️ Sunny
🕒 13:00 - 🌡️ 38.3°C, ☔ 0%, ☁️ Sunny
🕒 14:00 - 🌡️ 39.3°C, ☔ 0%, ☁️ Sunny
🕒 15:00 - 🌡️ 39.7°C, ☔ 0%, ☁️ Sunny
🕒 16:00 - 🌡️ 39.6°C, ☔ 0%, ☁️ Sunny
🕒 17:00 - 🌡️ 39.1°C, ☔ 0%, ☁️ Sunny
🕒 18:00 - 🌡️ 37.8°C, ☔ 0%, ☁️ Sunny
🕒 19:00 - 🌡️ 34.1°C, ☔ 0%, ☁️ Clear
🕒 20:00 - 🌡️ 32.7°C, ☔ 0%, ☁️ Clear
🕒 21:00 - 🌡️ 31.9°C, ☔ 0%, ☁️ Clear
🕒 22:00 - 🌡️ 31.2°C, ☔ 0%, ☁️ Clear
🕒 23:00 - 🌡️ 30.7°C, ☔ 0%, ☁️ Clear
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any changes.
- WeatherAPI for providing the weather data.
- Fatih Color for colorizing the output.
- Twiiter: chu_rill
- Email: [email protected]