Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions packages/unirate-currency-converter/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a little clearer. I had to follow the link to see what you meant. Perhaps change to:

"Prebuilt unirate binaries for Linux, macOS & Windows are available at the project's Release page."

[GitHub release](https://github.com/UniRate-API/unirate-cli/releases).

2. **Set a free API key** — [get one here](https://unirateapi.com) (no credit

@smeech smeech Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unirate website looks horrible - I tried two browsers - which doesn't inspire confidence!

Perhaps take people directly to the registration page at https://unirateapi.com/register, please?

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).
7 changes: 7 additions & 0 deletions packages/unirate-currency-converter/0.1.0/_manifest.yml
Original file line number Diff line number Diff line change
@@ -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"]
48 changes: 48 additions & 0 deletions packages/unirate-currency-converter/0.1.0/package.yml
Original file line number Diff line number Diff line change
@@ -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
Comment on lines +25 to +28

@smeech smeech Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not overly concerned about this - the package only acts upon user-entered data, although there's a non-zero risk of pasting unsanitised text into the form. Use of the above suggestion or quoted "$ESPANSO_ENVIRONMENT_VARIABLES" would reduce the risk of command injection, however.


# 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
Loading