Skip to content

TheDayIsMyEnemy/WeatherCli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeatherCli

WeatherCli is a simple tool that allows you to retrieve weather data using the OpenWeatherMap API, displaying the current weather in your terminal.

Installation

To install WeatherCli, you need to download the .NET 8.0 SDK. Once installed, run the following command:

dotnet tool install -g weathercli

Obtain a free API key here.

Usage

Current weather command

Usage: weather current [options] <CityName>

Arguments:
  CityName      You can call by city name or city name, state code and country code

Options:
  -d|--default  Sets a default city name
  -k|--apikey   Sets an OpenWeatherMap API key

Example using the current weather command:

weather current sofia -k YOUR_API_KEY

Example of successful response:

Sofia
Mist -2°C
Feels like -5°C. mist
Wind 1.0m/s N, 1021hPa, Humidity: 92%
Visibility: 2.8km

Optionally, you can omit the API key. To do that, you need to set the environment variable.

Windows command:

setx OPENWEATHERMAP_APIKEY YOUR_API_KEY

Linux command:

export OPENWEATHERMAP_APIKEY=YOUR_API_KEY

Contribution

  • If you want to contribute to this project, create a pull request
  • If you find any bugs or error, create an issue

License

Distributed under the MIT License. See LICENSE for more information.