@lesiv/weather-cli
v1.0.6
Published
weather cli
Downloads
16
Readme
Weather CLI
This is a command-line interface (CLI) application that allows you to get the weather forecast for a specific city. It utilizes an https://openweathermap.org/api to fetch the weather data and provides various functionalities to set the API key and city.
Installation
To use this application, you need to have Node.js installed on your machine. Clone the repository and navigate to the project directory. Then, run the following command to install the dependencies:
npm install
To make the application available globally, you can install it as a global package using the following command:
npm install -g @lesiv/weather-cli
After installing it globally, you can use the weather
command from anywhere in your terminal to access the application.
Please note that you might need administrative privileges to install the package globally on your machine.
Usage
The application can be executed using the following command:
weather [options]
Options
-h
: Display the help message.-s <city>
: Set the city for which you want to get the weather forecast.-t <key>
: Set the API key for accessing the weather data. (You need to create an account on OpenWeatherMap to obtain the API key.)
Examples
Get the weather forecast for the default city if city and token was provided before:
weather
Set the city to "London":
weather -s London
Set the API key:
weather -t YOUR_API_KEY
Error Handling
The application handles the following errors:
- If the city is not found, it displays an error message.
- If the API key is invalid, it displays an error message.
- If any other error occurs, it displays the error message.
License
This project is licensed under the MIT License. See the LICENSE file for more information.