A minimal, lightweight command-line interface for retrieving weather information via the OpenWeatherMap API.
- 🌍 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
- Node.js 18.0.0 or higher
- A free API key from OpenWeatherMap
git clone https://github.com/BaseVentura/openweather-cli.git
cd openweather-cli
npm install
npm run build
npm install -g .First time setup - initialize the CLI with your OpenWeatherMap API key:
weather --initYou'll be prompted to:
- Enter your OpenWeatherMap API key
- (Optionally) Set your favorite city for quick access
Get weather for a specific city:
weather London
weather "New York"Get weather for your favorite city (if set):
weatherView help:
weather --helpRe-initialize settings:
weather --init- Visit OpenWeatherMap
- Sign up for a free account
- Go to your API keys page
- Copy your default API key
- Use it when running
weather --init
npm installnpm run buildnpm run devnpm run lint
npm run lint:fixnpm run formatnpm run cleansrc/
├── 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
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
You haven't set up your API key yet. Run:
weather --initYour API key is incorrect or inactive. Re-run:
weather --initCheck the spelling and try again. The API uses city names from OpenWeatherMap's database.
ISC
Max Stricker