1.0.2 • Published 2 years ago
chingu-weather-cli v1.0.2
Weather CLI
Overview
The Weather CLI is a command-line interface tool built using nodejs and typescript that provides weather information for a specified location. It leverages data from OpenWeatherMap API to deliver current, hourly, and daily weather forecasts.
Features
- Get current weather information including temperature, conditions, and more.
- Retrieve hourly forecasts for up to 48 hours.
- Access daily forecasts for up to 8 days.
- Set and manage API keys for weather and locationIQ geocode services.
Installation
npm install -g weather-cliUsage
Running the project locally
- Clone the project
cd <rootdir>and runnpm install- Run
--set-key-weather <key>to set your OpenWeatherMap api key - Run
--set-key-geocodeto set your locationIQ api key - Run
ts-node ./src/cli.ts <command>- Alternatively to use the
weather-clicommand locally, in the root directory runnpm linkto globally install the package (don't forget to runnpm unlinkwhen you're done)
- Alternatively to use the
All available commands
The Weather CLI accepts a maximum of 2 location inputs eg weather-cli paris france and supports the following commands:
-for--farhenheit: Get temperature in Farhenheit.-cor--celsius: Get temperature in Celsius.-hor--help: Display help information.-cror--current: Get current weather.-mnor--minutely: Get weather forecast by the minute.-hror--hourly: Get hourly weather forecast.-dyor--daily: Get daily weather forecast.-sor--stat: Get additional weather statistics.--set-cor--set-key-geocode: Set Geocode API key.--set-wor--set-key-weather: Set Weather API key.
To use a command, run weather-cli followed by the desired command and additional options.
Examples
weather-cli --help
Get current forecase
weather-cli lagos -cr

Get hourly forecast(48hrs)
weather-cli paris france -hr --stat
Get daily forecasse(8days)
weather-cli chicago -dy
Configuration
The CLI tool requires API keys for both OpenWeather and locationIQ geocode services. Use the set-api-key-weather <key> and set-api-key-geocode <key> commands to configure these keys.
Dependencies
DevDependencies
- @types/node
- nodemon
- ts-node
- typescript
Dependencies
- dotenv
- @inquirer/select
To do
- Add unit tests
- Implement native cli select feature
- Implement CI/CD pipeline using github actions
- Implmenet feature to manage api keys
- Add more descriptive error messages
- Add loading spinner
- Refactor