_ | | ___ _ _ _ __ _ __ ___ _ __ ___ _ _ ___ ___ _ ____ _____ _ __| |_ ___ _ __ / __| | | | '__| '__/ _ \ '_ \ / __| | | | / __/ _ \| '_ \ \ / / _ \ '__| __/ _ \ '__| | (__| |_| | | | | | __/ | | | (__| |_| | | (_| (_) | | | \ V / __/ | | || __/ | \___|\__,_|_| |_| \___|_| |_|\___|\__, | \___\___/|_| |_|\_/ \___|_| \__\___|_| __/ | |___/
Currency Converter CLI program written in Go with natural-language interpretation.
This project is a command-line tool that uses the Open Exchange Rates API to provide currency conversion. With a focus on user-friendly interactions, this program uses natural language interpretation for input. To optimize performance and prevent excessive API calls, the CLI features a caching mechanism with a 5-minute expiry time. Additionally, there are unit tests for the natural language interpretation ensuring the reliability of the feature using the testing
package. My main objectives of this project was to get used to the Go programming language and its web capabilities.
showcase.mov
- Sign Up on Open Exchange Rate
- Set your app id as an environment variable by creating a .env file and assign
APP_ID
to your app id.
# .env
APP_ID=<APP_ID>
- In addition to the
APP_ID
, add the following constantsFILE_NAME
: Cache file name.CACHE_EXPIRY_IN_SECONDS
: Expiry time for cache in seconds.PRECISION
: Level of precision in output's digits.
# Example .env
APP_ID=<APP_ID>
FILE_NAME=cache.json
CACHE_EXPIRY_IN_SECONDS=300
PRECISION=2
- Run the CLI program using
go run .
- Build the executable
go build
- Once you compiled the code into a executable, you can directly run the executable (
./currencyconverter
on Unix systems,currencyconverter.exe
on Windows).