conditions 0.1.0

Fetch basic weather conditions for current or specified location
Documentation

Conditions

A command line tool for getting the weather conditions at the current location.

Weather Sources

* requires an api key

Usage

By default the Open-Meteo weather provider will be used along with a location determined by the machine's ip address.

> conditions current | jq
{
  "temp": 57,
  "icon": ""
}

Weather API

In order to use the Weather API provider create an account and then an API Key. Then persist the api key in settings.

conditions weather-api-key set [your-api-key]

Location

If you prefer to set a specific location you can do so via a postal code:

conditions location set "[postal-code], [country]"

For example:

conditions location set "10001, usa"

SketchyBar

Here's how I'm using this with SketchyBar.

#!/bin/bash

conditions="$(conditions current)"
icon=$(echo "$conditions" | jq -r .icon)
temp=$(echo "$conditions" | jq -r .temp)

sketchybar -m \
  --set weather_logo icon="${icon}" \
  --set weather label="${temp}°F"

Tasks

Run tasks from this directory via: xc [task-name]

check

cargo build

build

cargo build

run

cargo run

install

cargo install --path .

Dependencies

Project Version
rust-lang.org ^1.6
rust-lang.org/cargo ^0.66
git-scm.org ^2.38
xcfile.dev ^0

Why

I wanted to learn rust and had a (cargo-culted) shell script that performed this task for usage with sketchybar.