This is a command-line weather app written in Go that retrieves the current temperature and weather conditions of a city using the OpenWeatherMap API.
Before running the app, make sure you have the following:
- Go installed on your machine
- An API key from OpenWeatherMap. You can sign up for a free API key on their website.
-
Clone the repository:
git clone https://github.com/thecrazygm/gweather.git
-
Change into the project directory:
cd gweather
-
Create a
.env
file and add your OpenWeatherMap API key:OPENWEATHER_API_KEY=your-api-key
-
Build the app:
go build
To use the app, run the following command:
./gweather [city-name]
Replace [city-name]
with the name of the city you want to get the weather for.
-m, --metric
: Display temperature in Celsius (default is Fahrenheit)
Get weather in Fahrenheit:
./gweather "New York"
Get weather in Celsius:
./gweather -m "London"
The app will display the current temperature and weather conditions (e.g., Clear, Cloudy, Rain) for the specified city.
This project is licensed under the MIT License. See the LICENSE file for details.