An open API service indexing awesome lists of open source software.

https://github.com/SuaveIV/nu_script_wttr

Weather fetcher for Nushell using wttr.in
https://github.com/SuaveIV/nu_script_wttr

forecast nushell nushell-script weather-cli wttrin

Last synced: 12 days ago
JSON representation

Weather fetcher for Nushell using wttr.in

Awesome Lists containing this project

README

          

# wttr.in for Nushell

![Nushell 0.110+](https://img.shields.io/badge/nushell-0.110+-4E9A06?logo=nushell)

A weather fetcher for [Nushell](https://www.nushell.sh/) that pulls data from [wttr.in](https://wttr.in).

Turns wttr.in's weather data into formatted tables with color gradients, caching, and options for current conditions, forecasts, hourly breakdowns, and astronomy - all without leaving your terminal.

## What it does

Shows current weather, forecasts, and astronomy data in your terminal. Temperature gradients use ANSI colors. Works with Nerd Fonts by default, but you can switch to emojis or plain text if that's not your thing.

Caches results for 15 minutes so you don't hammer the API. Auto-detects your location from IP, or you can specify cities, airport codes, landmarks (with `~`), or domains (with `@`). Units switch between metric and imperial based on where you are, unless you override it.

Has a one-line mode for status bars, raw output for piping to other commands, and a debug mode when things aren't working.

## Screenshots

**Current weather:**

Current weather with Nerd Fonts

**3-day forecast:**

3-day forecast

**Hourly breakdown:**

Hourly forecast

**Astronomy data:**

Astronomy information

**Emoji mode:**

Emoji icons instead of Nerd Fonts

**Plain text mode:**

Plain text output

**Oneline mode:**

image

## Installation

> Nerd Font icons are enabled by default. Install a [Nerd Font](https://www.nerdfonts.com) and set it as your terminal font, or use `-e` for emojis or `-t` for plain text instead.

1. Download `weather.nu`
2. Put it in your Nushell scripts directory (`~/.config/nushell/scripts/` on Linux/Mac, `%APPDATA%\nushell\scripts\` on Windows)
3. Add this to your `config.nu`:

```nushell
use scripts/weather.nu
```

## Tips

**Set a default city** — add this to your `env.nu`:

```nushell
$env.WTTR_CITY = "New York"
```

This persists across sessions and takes priority over IP auto-detection, but can still be overridden per-call with an explicit argument.

**Change the default city in the script** — edit the `city` parameter default in `weather.nu`:

```nushell
city: string = "" # Change to your city, e.g. "New York"
```

**Pipe to other tools** — use `--raw` and `--text` together to strip formatting for clean serialization:

```nushell
weather -3 -r -t | to json
weather -3 -r -t | to toon # compact format for LLM input
weather -r -t | to json | clipboard copy # copy to clipboard as JSON
```

> TOON support via [fdncred/nu_plugin_toon](https://github.com/fdncred/nu_plugin_toon)
> Clipboard support via [fmotalleb/nu_plugin_clipboard](https://github.com/fmotalleb/nu_plugin_clipboard)

## Usage

```nushell
# Basic usage
weather # Current weather at your location
weather "New York" # Specific city
weather "Paris, France" # City and country
weather "JFK" # Airport code
weather "~Eiffel Tower" # Approximate location
weather "@github.com" # Domain location

# Display modes
weather -3, --forecast # 3-day forecast
weather -H, --hourly # Hourly breakdown (3-hour intervals)
weather -a, --astro # Sunrise, sunset, moon phase
weather -1, --oneline # One-line summary (for status bars)

# Unit and display options
weather -m, --metric # Force metric units (°C, km/h)
weather -i, --imperial # Force imperial units (°F, mph)
weather -e, --emoji # Use emojis instead of Nerd Fonts
weather -t, --text # Plain text, no icons or colors
weather --lang fr # Weather in French (or de, es, zh, etc.)

# Data output
weather -j, --json # Return full raw API response
weather -r, --raw # Return raw record data (for piping)

# Utility
weather -f, --force # Bypass cache and fetch fresh data
weather --clear-cache # Delete all cached weather data and exit
weather --debug # Show diagnostic info
weather --test # Use dummy data (no network request)
```