Skip to content

Latest commit

 

History

History
76 lines (57 loc) · 2.13 KB

README.md

File metadata and controls

76 lines (57 loc) · 2.13 KB

Vasant 🌤️

This is a simple Go-based CLI application that fetches and displays current and hourly weather forecast data for a specified location using the WeatherAPI.

✨ Features

  • Fetches current weather details and displays temperature and condition.
  • Provides an hourly forecast for the next 24 hours.
  • Highlights forecast hours with a high chance of rain using colored output.
  • Supports dynamic location input through command-line arguments.

🚨 Installation

To run this project locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/Abhay-hack/weather-cli-app.git
    cd weather-cli-app
  2. Install dependencies (e.g., fatih/color):

    go get github.com/fatih/color
  3. Build the application:

    go build -o weather.exe
  4. Set up your environment variable for the Weather API key:

    • Replace YOUR_API_KEY with your WeatherAPI key:
    export WEATHER_API_KEY=YOUR_API_KEY

Usage

Run the CLI application with the following command:

./weather [location]

Example

./weather "Lucknow"

If no location is provided, the default location "Lucknow" will be used.

Output Format

  • Displays the current weather condition and temperature of the specified location.
  • Displays hourly forecast with temperature, chance of rain, and conditions.
  • Uses colored text to highlight hours with a high chance of rain.

Code Structure

  • main.go: The main file containing the logic to fetch and parse weather data from the WeatherAPI.

Dependencies

  • fatih/color: A Go library used for colored output in the terminal.

API Key

To use this application, you need to sign up for a free API key at WeatherAPI and set it as an environment variable:

export WEATHER_API_KEY=your_api_key

🛠️ Technologies Used

🤝 Contributing

Contributions are welcome! Please fork this repository and submit a pull request with your changes.


Author: Abhay Gupta