#weather #open-weather-map #forecast #city #country #command-line #api

app weather_forecast

a basic project to determine the weather of different cities

2 unstable releases

0.3.0 Jan 28, 2024
0.2.0 Jan 28, 2024
0.1.0 Jan 28, 2024

#721 in Command line utilities

43 downloads per month

MIT license

91 lines

Weather Forecast CLI

This is a simple command-line interface (CLI) application that fetches weather forecast data from the OpenWeatherMap API based on the provided city and country code.


  • Rust: Make sure you have Rust installed on your system.


Clone the repository:

git clone https://github.com/tusharpamnani/Weather-Forecast.git
cd Weather-Forecast

Build the project:

cargo build --release


  1. Add your API key: Open the src/main.rs file and add your OpenWeatherMap API key to the following line (line 89):

  2. Run the CLI:

    cargo run <CITY> <COUNTRY_CODE>

    Replace <CITY> with the name of the city and <COUNTRY_CODE> with the country code (e.g., "ind" for India).


    cargo run nagpur ind


The CLI will display information about the provided city's weather forecast, including temperature, description, humidity, wind speed and direction, and sunrise/sunset times.

Example output:

Weather forecast for Nagpur (IND):
  - Temperature: 19.01 °C


This project is licensed under the MIT License - see the LICENSE file for details.


  • OpenWeatherMap for providing the weather forecast data through their API.
  • reqwest for HTTP client functionality.
  • serde for serialization and deserialization of JSON data.
  • structopt for easy command-line argument parsing.


~303K SLoC