CLI companion to the sporah microservice
  • Rust 76.5%
  • Shell 23.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Austin Schaefer 632c7a8547
All checks were successful
CI / audit (push) Successful in 13s
CI / ci (push) Successful in 1m38s
Merge pull request 'E2E tests against a mockito stub API, testing tiers' (#14) from feat/testing-tiers into master
Reviewed-on: #14
Reviewed-by: Austin Schaefer <austin.schaefer@mailo.eu>
2026-10-17 09:33:38 +00:00
.forgejo test: run the binary end to end against a stub API, add testing tiers 2026-10-16 22:31:03 +02:00
completions Remove stale completions and stop tracking .idea/ 2026-10-15 22:46:16 +02:00
src Apply rustfmt and fix clippy useless_vec 2026-10-16 12:47:10 +02:00
tests test: stub the API with mockito instead of a hand-written server 2026-10-17 11:05:28 +02:00
.gitignore Remove stale completions and stop tracking .idea/ 2026-10-15 22:46:16 +02:00
build.rs Apply rustfmt and fix clippy useless_vec 2026-10-16 12:47:10 +02:00
Cargo.lock test: stub the API with mockito instead of a hand-written server 2026-10-17 11:05:28 +02:00
Cargo.toml test: stub the API with mockito instead of a hand-written server 2026-10-17 11:05:28 +02:00
CLAUDE.md docs: the E2E stub is mockito now 2026-10-17 11:06:26 +02:00
LICENSE Add GPL-3.0 LICENSE, matching the server 2026-10-15 22:46:16 +02:00
README.md Gate release on master, smoke-test TLS, trust system CAs 2026-10-16 13:51:22 +02:00

sporah-cli

Terminal and waybar client for the Sporah pollen API. It shows current pollen levels as Unicode bar graphs.

$ sporah city Berlin    # in season; output illustrative
Berlin
  alder:   🌳 ██░░░
  birch:   🌲 ███░░
  grass:   🌱 █░░░░
  ...

The API only covers Europe, and outside the pollen season it often has no data. In both cases (the API answers 204 or 400) sporah prints "no pollen data available" and exits with status 1.

Install

Download a prebuilt static Linux binary (x86_64, runs on any distro) from releases:

version=0.1.0   # the latest release
curl -LO "https://code.austinschaefer.com/schaefera/sporah-cli/releases/download/v$version/sporah-$version-x86_64-linux.tar.gz"
curl -LO "https://code.austinschaefer.com/schaefera/sporah-cli/releases/download/v$version/SHA256SUMS"
sha256sum -c SHA256SUMS
tar -xzf "sporah-$version-x86_64-linux.tar.gz"
mkdir -p ~/.local/bin
install -m 755 "sporah-$version-x86_64-linux/sporah" ~/.local/bin/

The archive also contains the shell completions (see below).

Or build from source (needs a Rust toolchain):

cargo install --git https://code.austinschaefer.com/schaefera/sporah-cli

Usage

sporah city Berlin                      # by city name
sporah city "Rothenburg ob der Tauber"  # quote names with spaces
sporah coords --lat 52.52 --lon 13.40   # by coordinates
sporah --values-only city Berlin        # bars only, no pollen type names

Global options go before the subcommand:

Option Default Description
--url <URL> / SPORAH_URL https://api.sporah.eu API base URL, e.g. for a self-hosted instance
--waybar off Print one pollen type per line, rotating forever
--interval <SECS> 2 Seconds per pollen type in waybar mode
--refresh <SECS> 3600 Seconds between API fetches in waybar mode
--values-only off Omit the pollen type name prefix

Waybar

In --waybar mode the CLI keeps running and prints a new line every --interval seconds, cycling through the pollen types that currently have data. Use it as a continuous custom module:

"custom/pollen": {
    "exec": "sporah --waybar city Berlin",
    "restart-interval": 60
}

sporah exits on any fetch error, including a refresh inside the loop and the no-data case above. restart-interval makes waybar start it again.

Shell completions

completions/ contains generated completions (build.rs regenerates them on each build):

# bash
cp completions/sporah.bash ~/.local/share/bash-completion/completions/sporah

# zsh: copy into any directory on your $fpath
cp completions/_sporah ~/.zsh/completions/_sporah

Self-hosting the API

See the server repo, then point the CLI at your instance with SPORAH_URL.

License

GPL-3.0. See LICENSE.