|
1 | | -# wx-cli |
| 1 | +# wx-cli 🌦️ |
| 2 | +Simple, cross‑platform CLI for a fast 7‑day weather forecast |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +`wx-cli` pulls live data from **WeatherAPI.com** and presents it in a tidy, Unicode‑powered table. |
| 8 | +It auto‑detects your location via **ipinfo.io**, so a single command is all you need: |
| 9 | + |
| 10 | +```bash |
| 11 | +wx-cli forecast |
| 12 | +```` |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## ✨ Features |
| 17 | + |
| 18 | +* **One‑command forecast** – no flags required |
| 19 | +* **Auto‑detect location** using your public IP |
| 20 | +* 7‑day forecast with sunrise/sunset, temps & rain chance |
| 21 | +* Works anywhere Go runs (Windows, Linux, macOS) |
| 22 | +* Zero runtime dependencies beyond the compiled binary |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## 📸 Quick Demo |
| 27 | + |
| 28 | +```bash |
| 29 | +$ wx-cli forecast |
| 30 | +┌────────────────────────────────────────────────────────────┐ |
| 31 | +│ 🌍 Location: Houston, Texas, United States |
| 32 | +│ 📅 Date: 05/12 | Monday |
| 33 | +├────────────────────────────────────────────────────────────┤ |
| 34 | +│ 🌡️ Current: partly cloudy, 78°F (Feels like 80°F) |
| 35 | +│ 🔽 Min: 72°F | 🔼 Max: 86°F |
| 36 | +│ 💧 Humidity: 64% |
| 37 | +└────────────────────────────────────────────────────────────┘ |
| 38 | +
|
| 39 | +📅 6‑Day Forecast: |
| 40 | +┌───────────┬───────────┬─────────────┬──────────────────────┬──────────┬──────────┐ |
| 41 | +│ Date │ Temp (°F) │ Rain Chance │ Condition │ Sunrise │ Sunset │ |
| 42 | +├───────────┼───────────┼─────────────┼──────────────────────┼──────────┼──────────┤ |
| 43 | +│ 05/12 Mon │ 78 │ 0 % │ partly cloudy │ 06:20 AM │ 08:04 PM │ |
| 44 | +│ … │ │ │ │ │ │ |
| 45 | +└───────────┴───────────┴─────────────┴──────────────────────┴──────────┴──────────┘ |
| 46 | +``` |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## 🚀 Installation |
| 51 | + |
| 52 | +### Prerequisites |
| 53 | + |
| 54 | +| Requirement | Notes | |
| 55 | +| ------------------ | ------------------------------------------------------------------------ | |
| 56 | +| **Go 1.21+** | In your `PATH` | |
| 57 | +| **WeatherAPI key** | Sign up free at [https://www.weatherapi.com](https://www.weatherapi.com) | |
| 58 | + |
| 59 | +### 1. Install via `go install` (recommended) |
| 60 | + |
| 61 | +```bash |
| 62 | +go install github.com/hazeliscoding/wx-cli@latest |
| 63 | +``` |
| 64 | + |
| 65 | +This drops a binary in **`$GOPATH/bin`** (commonly `~/go/bin`). |
| 66 | +Add that directory to your *PATH* so you can call `wx-cli` anywhere. |
| 67 | + |
| 68 | +### 2. (or) Build from source |
| 69 | + |
| 70 | +```bash |
| 71 | +git clone https://github.com/hazeliscoding/wx-cli.git |
| 72 | +cd wx-cli |
| 73 | +go build -o wx-cli . |
| 74 | +``` |
| 75 | + |
| 76 | +On Windows you’ll get `wx-cli.exe`. |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +## 🔧 Configuration |
| 81 | + |
| 82 | +`wx-cli` looks for an environment variable **`WEATHERAPI_API_KEY`**. |
| 83 | +Create a small `.env` file so you don’t have to export it every session. |
| 84 | + |
| 85 | +| OS | One‑liner | |
| 86 | +| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 87 | +| **Linux / macOS** | `bash mkdir -p ~/.config/wx-cli && echo "WEATHERAPI_API_KEY=<YOUR_KEY>" > ~/.config/wx-cli/.env ` | |
| 88 | +| **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>' ` | |
| 89 | + |
| 90 | +> Prefer a global variable? |
| 91 | +> • Linux/macOS `export WEATHERAPI_API_KEY=…` |
| 92 | +> • Windows `setx WEATHERAPI_API_KEY …` |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## 🏃 Usage |
| 97 | + |
| 98 | +```bash |
| 99 | +wx-cli forecast # normal usage – auto‑detects city & region |
| 100 | +go run . forecast # if you’re hacking inside the repo |
| 101 | +``` |
| 102 | + |
| 103 | +Exit codes: `0` = success · `1` = config/network error. |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +## 🤝 Contributing |
| 108 | + |
| 109 | +1. Fork & create a feature branch |
| 110 | +2. `go fmt ./...` before committing |
| 111 | +3. Open a PR – GitHub Actions will run checks |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## 🗺 Roadmap |
| 116 | + |
| 117 | +* `--city` / `--zip` flags to override auto‑detect |
| 118 | +* Metric/°C output |
| 119 | +* Caching for offline viewing |
| 120 | +* Test suite & CI badges |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | +## 📝 License |
| 125 | + |
| 126 | +This project is released under the **MIT License**. |
| 127 | +See the [LICENSE](LICENSE) file for details. |
| 128 | + |
| 129 | +<br> |
| 130 | + |
| 131 | +Made with ❤️ by [Hazel Granados](https://github.com/hazeliscoding) |
0 commit comments