Skip to content

hazeliscoding/wx-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wx-cli πŸŒ¦οΈ

Simple, cross‑platform CLI for a fast 7‑day weather forecast

Go version License

wx-cli pulls live data from WeatherAPI.com and presents it in a tidy, Unicode‑powered table.
It auto‑detects your location via ipinfo.io, so a single command is all you need:

wx-cli forecast

✨ Features

  • One‑command forecast – no flags required
  • Auto‑detect location using your public IP
  • 7‑day forecast with sunrise/sunset, temps & rain chance
  • Works anywhere Go runs (Windows, Linux, macOS)
  • Zero runtime dependencies beyond the compiled binary

πŸ“Έ Quick Demo

$ wx-cli forecast
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 🌍 Location: Houston, Texas, United States
β”‚ πŸ“… Date: 05/12 | Monday
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 🌑️ Current: partly cloudy, 78Β°F (Feels like 80Β°F)
β”‚ πŸ”½ Min: 72Β°F | πŸ”Ό Max: 86Β°F
β”‚ πŸ’§ Humidity: 64%
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“… 6‑Day Forecast:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Date    β”‚ Temp (Β°F) β”‚ Rain Chance β”‚      Condition       β”‚ Sunrise  β”‚  Sunset  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 05/12 Mon β”‚       78  β”‚  0β€―%        β”‚ partly cloudy        β”‚ 06:20 AM β”‚ 08:04 PM β”‚
β”‚ …         β”‚           β”‚             β”‚                      β”‚          β”‚          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Installation

Prerequisites

Requirement Notes
Go 1.21+ In yourβ€―PATH
WeatherAPI key Sign up free at https://www.weatherapi.com

1.β€―Install via go install (recommended)

go install github.com/hazeliscoding/wx-cli@latest

This drops a binary in $GOPATH/bin (commonly ~/go/bin). Add that directory to your PATH so you can call wx-cli anywhere.

2.β€―(or) Build from source

git clone https://github.com/hazeliscoding/wx-cli.git
cd wx-cli
go build -o wx-cli .

On Windows you’ll getβ€―wx-cli.exe.


πŸ”§ Configuration

wx-cli looks for an environment variable WEATHERAPI_API_KEY. Create a small .env file so you don’t have to export it every session.

OS One‑liner
Linux / macOS bash mkdir -p ~/.config/wx-cli && echo "WEATHERAPI_API_KEY=<YOUR_KEY>" > ~/.config/wx-cli/.env
Windowsβ€―(PowerShell) pwsh New-Item -ItemType Directory -Force "$env:USERPROFILE\.config\wx-cli"; Set-Content "$env:USERPROFILE\.config\wx-cli\.env" 'WEATHERAPI_API_KEY=<YOUR_KEY>'

Prefer a global variable? β€’β€―Linux/macOS export WEATHERAPI_API_KEY=… β€’β€―Windows setx WEATHERAPI_API_KEY …


πŸƒ Usage

wx-cli forecast         # normal usage – auto‑detects city & region
go run . forecast       # if you’re hacking inside the repo

Exit codes: 0 = success Β· 1 = config/network error.


🀝 Contributing

  1. Fork & create a feature branch
  2. go fmt ./... before committing
  3. Open a PR – GitHub Actions will run checks

πŸ—Ί Roadmap

  • --city / --zip flags to override auto‑detect
  • Metric/Β°C output
  • Caching for offline viewing
  • Test suite & CI badges

πŸ“ License

This project is released under the MITβ€―License. See the LICENSE file for details.


Made with ❀️ by Hazel Granados

About

Command line tool to check the weather of your current location.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages