Skip to content

Instantly share code, notes, and snippets.

@paul-d-ray
Last active September 28, 2025 03:04
Show Gist options
  • Select an option

  • Save paul-d-ray/f7525812f29b4be5c71bea67bc77ea65 to your computer and use it in GitHub Desktop.

Select an option

Save paul-d-ray/f7525812f29b4be5c71bea67bc77ea65 to your computer and use it in GitHub Desktop.
Nushell CLI Weather Forecast

Using Nushell to get Local Weather

I saw on Hacker News for another programming lanuage. I wanted to get the forecast for my area using Nushell.

  • I used Grok to get the code for my location.

Nushell Code

http get https://api.weather.gov/gridpoints/FFC/32,107/forecast | from json |
  get properties.periods |
  each {
     {
         date: ($in.startTime | format date "%Y-%m-%d"),
         name: $in.name,
         temp: $"($in.temperature)° ($in.temperatureUnit)",
         windSpeed: $in.windSpeed,
         detailedForecast: $in.detailedForecast
     }
 } |
  group-by date

Output Sample

╭────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                │ ╭───┬────────────┬─────────┬───────┬───────────┬──────────────────────────────────────────────────────────────╮                                                                 │
│ 2025-09-27     │ │ # │    date    │  name   │ temp  │ windSpeed │                       detailedForecast                       │                                                                 │
│                │ ├───┼────────────┼─────────┼───────┼───────────┼──────────────────────────────────────────────────────────────┤                                                                 │
│                │ │ 0 │ 2025-09-27 │ Tonight │ 62° F │ 0 mph     │ Mostly clear, with a low around 62. North wind around 0 mph. │                                                                 │
│                │ ╰───┴────────────┴─────────┴───────┴───────────┴──────────────────────────────────────────────────────────────╯                                                                 │
│                │ ╭───┬────────────┬──────────────┬───────┬────────────┬──────────────────────────────────────────────────────────────────╮                                                       │
│ 2025-09-28     │ │ # │    date    │     name     │ temp  │ windSpeed  │                         detailedForecast                         │                                                       │
│                │ ├───┼────────────┼──────────────┼───────┼────────────┼──────────────────────────────────────────────────────────────────┤                                                       │
│                │ │ 0 │ 2025-09-28 │ Sunday       │ 86° F │ 0 to 5 mph │ Mostly sunny, with a high near 86. Northeast wind 0 to 5 mph.    │                                                       │
│                │ │ 1 │ 2025-09-28 │ Sunday Night │ 64° F │ 5 mph      │ Mostly clear, with a low around 64. Northeast wind around 5 mph. │                                                       │
│                │ ╰───┴────────────┴──────────────┴───────┴────────────┴──────────────────────────────────────────────────────────────────╯                                                       │
│                │ ╭───┬────────────┬──────────────┬───────┬─────────────┬──────────────────────────────────────────────────────────────────╮                                                      │
│ 2025-09-29     │ │ # │    date    │     name     │ temp  │  windSpeed  │                         detailedForecast                         │                                                      │
│                │ ├───┼────────────┼──────────────┼───────┼─────────────┼──────────────────────────────────────────────────────────────────┤                                                      │
│                │ │ 0 │ 2025-09-29 │ Monday       │ 84° F │ 5 to 10 mph │ Sunny, with a high near 84. East wind 5 to 10 mph.               │                                                      │
│                │ │ 1 │ 2025-09-29 │ Monday Night │ 62° F │ 0 to 10 mph │ Partly cloudy, with a low around 62. Northeast wind 0 to 10 mph. │                                                      │
│                │ ╰───┴────────────┴──────────────┴───────┴─────────────┴──────────────────────────────────────────────────────────────────╯                                                      │
│                │ ╭───┬────────────┬───────────────┬───────┬─────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮     │
│ 2025-09-30     │ │ # │    date    │     name      │ temp  │  windSpeed  │                                                 detailedForecast                                                 │     │
│                │ ├───┼────────────┼───────────────┼───────┼─────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤     │
│                │ │ 0 │ 2025-09-30 │ Tuesday       │ 83° F │ 0 to 10 mph │ A slight chance of rain showers after 2pm. Mostly sunny, with a high near 83. Chance of precipitation is 20%.    │     │
│                │ │ 1 │ 2025-09-30 │ Tuesday Night │ 63° F │ 5 to 10 mph │ A slight chance of rain showers before 8pm. Partly cloudy, with a low around 63. Chance of precipitation is 20%. │     │
│                │ ╰───┴────────────┴───────────────┴───────┴─────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯     │
│                │ ╭───┬────────────┬─────────────────┬───────┬───────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮     │
│ 2025-10-01     │ │ # │    date    │      name       │ temp  │ windSpeed │                                                 detailedForecast                                                 │     │
│                │ ├───┼────────────┼─────────────────┼───────┼───────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤     │
│                │ │ 0 │ 2025-10-01 │ Wednesday       │ 78° F │ 5 mph     │ A slight chance of rain showers after 2pm. Partly sunny, with a high near 78. Chance of precipitation is 20%.    │     │
│                │ │ 1 │ 2025-10-01 │ Wednesday Night │ 60° F │ 5 mph     │ A slight chance of rain showers before 2am. Partly cloudy, with a low around 60. Chance of precipitation is 20%. │     │
│                │ ╰───┴────────────┴─────────────────┴───────┴───────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯     │
│                │ ╭───┬────────────┬────────────────┬───────┬─────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮    │
│ 2025-10-02     │ │ # │    date    │      name      │ temp  │  windSpeed  │                                                 detailedForecast                                                 │    │
│                │ ├───┼────────────┼────────────────┼───────┼─────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤    │
│                │ │ 0 │ 2025-10-02 │ Thursday       │ 75° F │ 5 to 10 mph │ A slight chance of rain showers after 2pm. Mostly sunny, with a high near 75. Chance of precipitation is 20%.    │    │
│                │ │ 1 │ 2025-10-02 │ Thursday Night │ 55° F │ 10 mph      │ A slight chance of rain showers before 2am. Partly cloudy, with a low around 55. Chance of precipitation is 20%. │    │
│                │ ╰───┴────────────┴────────────────┴───────┴─────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯    │
│                │ ╭───┬────────────┬──────────────┬───────┬─────────────┬──────────────────────────────────────╮                                                                                  │
│ 2025-10-03     │ │ # │    date    │     name     │ temp  │  windSpeed  │           detailedForecast           │                                                                                  │
│                │ ├───┼────────────┼──────────────┼───────┼─────────────┼──────────────────────────────────────┤                                                                                  │
│                │ │ 0 │ 2025-10-03 │ Friday       │ 75° F │ 10 mph      │ Sunny, with a high near 75.          │                                                                                  │
│                │ │ 1 │ 2025-10-03 │ Friday Night │ 55° F │ 5 to 10 mph │ Partly cloudy, with a low around 55. │                                                                                  │
│                │ ╰───┴────────────┴──────────────┴───────┴─────────────┴──────────────────────────────────────╯                                                                                  │
│                │ ╭───┬────────────┬──────────┬───────┬─────────────┬────────────────────────────────────╮                                                                                        │
│ 2025-10-04     │ │ # │    date    │   name   │ temp  │  windSpeed  │          detailedForecast          │                                                                                        │
│                │ ├───┼────────────┼──────────┼───────┼─────────────┼────────────────────────────────────┤                                                                                        │
│                │ │ 0 │ 2025-10-04 │ Saturday │ 75° F │ 5 to 10 mph │ Mostly sunny, with a high near 75. │                                                                                        │
│                │ ╰───┴────────────┴──────────┴───────┴─────────────┴────────────────────────────────────╯                                                                                        │
╰────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment