This is a simple command-line interface (CLI) application that fetches and displays the weather forecast for a given location.
- Clone this repository:
git clone <repository_url>
- Navigate to the project directory:
cd <project_directory>
- Build the application:
go build
-
Set up your Weather API key:
-
Sign up on WeatherAPI to get your API key.
-
Create a file named
.env
in the project directory. -
Add your Weather API key to the
.env
file:WEATHER_API_KEY=your_weather_api_key
-
Run the application from the command line with the following command:
./weather-cli [location]
Replace [location]
with the name of the location for which you want to check the weather. If no location is provided, the default location is set to "Blumenau".
Example:
./weather-cli London
github.com/fatih/color
: For colorizing output.github.com/joho/godotenv
: For loading environment variables from a.env
file.
- This application uses the WeatherAPI to fetch weather data.
- It displays the current weather condition and temperature, along with a forecast for the day.
- The forecast includes the temperature, chance of rain, and weather condition for each hour.
- Hours that have already passed are skipped.
- Output colors are used to highlight hours with a high chance of rain.
Feel free to modify and extend this application according to your needs!