From f1c600e1084049426a48558b953bf49a382224b9 Mon Sep 17 00:00:00 2001 From: rob-browncc <199503049+rob-browncc@users.noreply.github.com> Date: Thu, 17 Sep 2026 07:31:17 +0300 Subject: [PATCH] Add unirate-currency-converter package Inline currency conversion and live exchange-rate lookups via the zero-dependency unirate CLI (UniRate API). Two form-based triggers (:fx, :rate); read-only HTTPS GETs only. --- .../0.1.0/README.md | 64 +++++++++++++++++++ .../0.1.0/_manifest.yml | 7 ++ .../0.1.0/package.yml | 48 ++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 packages/unirate-currency-converter/0.1.0/README.md create mode 100644 packages/unirate-currency-converter/0.1.0/_manifest.yml create mode 100644 packages/unirate-currency-converter/0.1.0/package.yml diff --git a/packages/unirate-currency-converter/0.1.0/README.md b/packages/unirate-currency-converter/0.1.0/README.md new file mode 100644 index 00000000..29d26d05 --- /dev/null +++ b/packages/unirate-currency-converter/0.1.0/README.md @@ -0,0 +1,64 @@ +# UniRate Currency Converter + +Convert amounts and look up live exchange rates without leaving whatever you're +typing in. Powered by the [UniRate API](https://unirateapi.com) via the small, +zero-dependency [`unirate` CLI](https://github.com/UniRate-API/unirate-cli). + +## Triggers + +| Trigger | What it does | Example output | +|---|---|---| +| `:fx` | Opens a form (amount / from / to) and converts | `100 USD = 92.5 EUR` | +| `:rate` | Opens a form (from / to) and returns the unit rate | `1 USD = 150 JPY` | + +Currency codes are the usual ISO-4217 codes (`USD`, `EUR`, `JPY`, `GBP`, …); +170+ fiat and crypto currencies are supported. + +## Setup + +This package shells out to the `unirate` CLI, so you need two things: + +1. **Install the CLI** — pick one: + + ```bash + # macOS (Homebrew) + brew install --cask UniRate-API/unirate/unirate + + # Windows (Scoop) + scoop bucket add unirate https://github.com/UniRate-API/scoop-unirate + scoop install unirate + + # Any platform with a Go toolchain + go install github.com/UniRate-API/unirate-cli@latest + ``` + + Prebuilt binaries for linux/macOS/windows are also attached to each + [GitHub release](https://github.com/UniRate-API/unirate-cli/releases). + +2. **Set a free API key** — [get one here](https://unirateapi.com) (no credit + card), then export it so espanso's shell commands can see it: + + ```bash + export UNIRATE_API_KEY="your-api-key" + ``` + + Put that line in your shell profile (`~/.bashrc`, `~/.zshrc`, or the Windows + equivalent) and restart espanso so it inherits the variable. + +Verify the CLI works on its own first: + +```bash +unirate convert 100 USD EUR +# 100 USD = 92.5 EUR +``` + +## Notes + +- Both triggers are **read-only** — they make an HTTPS GET to the UniRate API + and print the result. Nothing is written to or changed on your system. +- If a trigger expands to nothing, the CLI probably isn't on espanso's PATH or + `UNIRATE_API_KEY` isn't set in the environment espanso was launched from. + +## License + +MIT — see the [`unirate-cli` repository](https://github.com/UniRate-API/unirate-cli). diff --git a/packages/unirate-currency-converter/0.1.0/_manifest.yml b/packages/unirate-currency-converter/0.1.0/_manifest.yml new file mode 100644 index 00000000..669ae4cd --- /dev/null +++ b/packages/unirate-currency-converter/0.1.0/_manifest.yml @@ -0,0 +1,7 @@ +name: "unirate-currency-converter" +title: "UniRate Currency Converter" +description: "Convert amounts and look up live exchange rates inline, powered by the UniRate API command-line client." +version: 0.1.0 +author: UniRate API +homepage: "https://github.com/UniRate-API/unirate-cli" +tags: ["currency", "exchange-rate", "forex", "money", "converter", "finance", "unirate"] diff --git a/packages/unirate-currency-converter/0.1.0/package.yml b/packages/unirate-currency-converter/0.1.0/package.yml new file mode 100644 index 00000000..875e46d0 --- /dev/null +++ b/packages/unirate-currency-converter/0.1.0/package.yml @@ -0,0 +1,48 @@ +# UniRate Currency Converter +# +# Requires the `unirate` CLI on your PATH and a free UNIRATE_API_KEY in your +# environment. See the README for setup. Both commands are read-only HTTPS GETs +# against the UniRate API — they never write to or modify the system. + +matches: + # Convert an amount between two currencies. + # :fx -> form (amount / from / to) -> e.g. "100 USD = 92.5 EUR" + - trigger: ":fx" + replace: "{{result}}" + vars: + - name: form + type: form + params: + layout: "Convert [[amount]] [[from]] into [[to]]" + fields: + amount: + default: "100" + from: + default: "USD" + to: + default: "EUR" + - name: result + type: shell + params: + cmd: "unirate convert {{form.amount}} {{form.from}} {{form.to}}" + trim: true + + # Look up the live rate for a single currency pair. + # :rate -> form (from / to) -> e.g. "1 USD = 150 JPY" + - trigger: ":rate" + replace: "{{result}}" + vars: + - name: form + type: form + params: + layout: "Exchange rate: 1 [[from]] in [[to]]" + fields: + from: + default: "USD" + to: + default: "EUR" + - name: result + type: shell + params: + cmd: "unirate rate {{form.from}} {{form.to}}" + trim: true