chingu-weather-cli
v1.0.2
Published
## Overview
Downloads
4
Readme
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-cli
Usage
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-geocode
to set your locationIQ api key - Run
ts-node ./src/cli.ts <command>
- Alternatively to use the
weather-cli
command locally, in the root directory runnpm link
to globally install the package (don't forget to runnpm unlink
when 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:
-f
or--farhenheit
: Get temperature in Farhenheit.-c
or--celsius
: Get temperature in Celsius.-h
or--help
: Display help information.-cr
or--current
: Get current weather.-mn
or--minutely
: Get weather forecast by the minute.-hr
or--hourly
: Get hourly weather forecast.-dy
or--daily
: Get daily weather forecast.-s
or--stat
: Get additional weather statistics.--set-c
or--set-key-geocode
: Set Geocode API key.--set-w
or--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