Skip to content

About

minimal weather cli which uses openWeatherMap to retrieve information about the daily weather

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

☀️ OpenWeather CLI

A minimal, lightweight command-line interface for retrieving weather information via the OpenWeatherMap API.

Features

  • 🌍 Get weather for any city in the world
  • 💾 Save your favorite city for quick lookups
  • 🎨 Colored, readable output
  • ⚡ Fast and lightweight
  • 🔧 Easy setup and configuration

Prerequisites

Installation

From Source

git clone https://github.com/BaseVentura/openweather-cli.git
cd openweather-cli
npm install
npm run build
npm install -g .

Setup

First time setup - initialize the CLI with your OpenWeatherMap API key:

weather --init

You'll be prompted to:

  1. Enter your OpenWeatherMap API key
  2. (Optionally) Set your favorite city for quick access

Usage

Get weather for a specific city:

weather London
weather "New York"

Get weather for your favorite city (if set):

weather

View help:

weather --help

Re-initialize settings:

weather --init

Getting an API Key

  1. Visit OpenWeatherMap
  2. Sign up for a free account
  3. Go to your API keys page
  4. Copy your default API key
  5. Use it when running weather --init

Development

Prerequisites

npm install

Build

npm run build

Watch Mode

npm run dev

Linting

npm run lint
npm run lint:fix

Format Code

npm run format

Clean Build

npm run clean

Project Structure

src/
├── index.ts                      # Entry point
├── rawWeatherData.interface.ts   # API response types
├── weatherData.interface.ts      # Formatted weather types
└── util/
    ├── init.ts                   # CLI initialization
    ├── parseWeatherData.ts       # Data parsing logic
    └── printOutput.ts            # Output formatting

Configuration

Settings are stored in your OS config directory:

  • macOS: ~/Library/Preferences/openweather-cli-nodejs
  • Linux: ~/.config/openweather-cli-nodejs
  • Windows: %APPDATA%\openweather-cli-nodejs\Config

Troubleshooting

"Please initialize the tool via --init"

You haven't set up your API key yet. Run:

weather --init

"Error: Invalid API key"

Your API key is incorrect or inactive. Re-run:

weather --init

"City not found"

Check the spelling and try again. The API uses city names from OpenWeatherMap's database.

License

ISC

Author

Max Stricker

Related

About

minimal weather cli which uses openWeatherMap to retrieve information about the daily weather

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages