Currency converter
This commit is contained in:
parent
1ac63ac180
commit
5c0904e558
13
src/bin/dosh
Executable file
13
src/bin/dosh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/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"
|
||||
}
|
Loading…
Reference in a new issue