irs/src/bin/dosh

14 lines
394 B
Text
Raw Normal View History

2025-01-21 12:12:58 +01:00
#!/usr/bin/env nu
# TODO: include fallback to alternate URL: https://latest.currency-api.pages.dev/v1
let base_url = 'https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1'
def main [target:string = "usd", source:string = "eur"] {
(http get $"($base_url)/currencies/($source).json") | get $source | get $target
}
def "main list" [ ] {
http get $"($base_url)/currencies.json"
}