CLI for dual-currency conversion made with Typescript and Deno.
This project was made with the Deno Javascript/Typescript runtime environment,
so make sure you have Deno installed on your system to install the conv
. You
can install Deno from https://deno.land/#installation.
deno install -A -n conv https://deno.land/x/conv/index.ts
conv
was made with the well-known NPM package inquirer
to ask questions to
the user on the fly (when the program is running), so all you need to do is
execute the program and follow the prompt instructions.
conv
_ ____ _
| | / ___| ___ _ __ __ __ | |
/ __) | | / _ \ | '_ \ \ \ / / / __)
\__ \ | |___ | (_) | | | | | \ V / \__ \
( / \____| \___/ |_| |_| \_/ ( /
|_| |_|
? Select 'from' currency: EUR
? Select 'to' currency: USD
EUR = 1.0864957797 USD 💱
? Retry? No
Bye 👋
If you are more of that fast-single-command type of person, you may want to use the command options available.
-f, --from
: Set the from currency, i.e. the base currency.-t, --to
: Set the to currency, i.e. the converted currency.
You have to provide for both
-f
and-t
options its respectives currency codes (capitalized, uncapitalized or mixed). You can see the list of currencies supported with thelist
command as seen in the section below.
conv
also includes the following commands.
list
: Lists the currencies available.help
: Shows the options and commands and their description.
The API used in order to get the currency data is the FreecurrencyAPI (https://freecurrencyapi.com/). Unfortunately, this program does not offer a full dedicated API key(s) to provide a better user experience.
However, you can still get a 100% free API key 🔑 by signing up in their website https://freecurrencyapi.com/register. When you successfully register, you will get a key that you can use with this application.
Next, you just need to export an environment variable FC_API_KEY
.
export FC_API_KEY=<your-api-key>
As a convenience, you can export the variable automatically every time you start
a shell editing your .bashrc
file or equivalent shell.
# ~/.bashrc
...
export FC_API_KEY=<your-api-key>
Finally, just run conv
and it should be ready to use 🚀.
make examples of CLI interface
Read the CONTRIBUTING.md file to follow the instructions to contribute to this repository.
This project is licensed under the MIT License - see the LICENSE file for details.