secluded/content/posts/forecasting-with-a-command.md

29 lines
1.4 KiB
Markdown
Raw Normal View History

2021-01-11 17:34:38 +00:00
---
title: "Forecasting with a command"
description: "Using a single command to get the week's weather forecast"
2021-11-10 08:07:08 +00:00
author: Amolith
cover: ../../static/assets/pngs/weather.png
2021-01-11 17:34:38 +00:00
date: 2018-12-14T21:41:00-04:00
categories:
- Technology
tags:
- CLI
---
We all love the CLI *(and if we don't, we should)* so wouldn't it be great if there was a tool to see your weather forecast with a single command? Ceda EI at <a href="https://webionite.com" target="_blank">webionite.com</a> has written a tool that uses the Dark Sky API to give you the forecast for a day or week, at your location, and in Celsius or Fahrenheit.
## Celsius
+ Weather for one week - `$ curl sky.webionite.com/location`
+ Weather for today - `$ curl sky.webionite.com/location/t`
## Fahrenheit
+ Weather for one week - `$ curl sky.webionite.com/f/location`
+ Weather for today - `$ curl sky.webionite.com/f/location/t`
A great way to make this faster and simpler is to put an alias in your shell's `rc` file. For bash, you can do that with:
2021-03-22 06:55:30 +00:00
```bash
2021-01-11 17:34:38 +00:00
echo "alias weather='curl sky.webionite.com/f/location'" >> ~/.bashrc
```
2021-03-22 06:55:30 +00:00
2021-01-11 17:34:38 +00:00
If you ever forget how to use the tool, just run `curl sky.webionite.com` and you'll be given instructions.
![screenshot of the output of the command. it shows two rows of four boxes with ascii art depicting rain, overcast clouds, and the sun obscured by clouds. it shows the temperature and the time of day. everything is coloured and looks very attractive.](/assets/pngs/weather.png)