Skip to content

Latest commit

 

History

History
58 lines (47 loc) · 2.77 KB

README.md

File metadata and controls

58 lines (47 loc) · 2.77 KB
                                                                            _            
                                                                           | |           
   ___ _   _ _ __ _ __ ___ _ __   ___ _   _    ___ ___  _ ____   _____ _ __| |_ ___ _ __ 
  / __| | | | '__| '__/ _ \ '_ \ / __| | | |  / __/ _ \| '_ \ \ / / _ \ '__| __/ _ \ '__|
 | (__| |_| | |  | | |  __/ | | | (__| |_| | | (_| (_) | | | \ V /  __/ |  | ||  __/ |   
  \___|\__,_|_|  |_|  \___|_| |_|\___|\__, |  \___\___/|_| |_|\_/ \___|_|   \__\___|_|   
                                       __/ |                                             
                                      |___/                                              

Currency Converter CLI program written in Go with natural-language interpretation.

GitHub top language GitHub last commit (branch) GitHub code size in bytes

Introduction

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

showcase.mov

Usage

Getting Started

  1. Sign Up on Open Exchange Rate
  2. 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>
  1. In addition to the APP_ID, add the following constants
    • FILE_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
  1. Run the CLI program using go run .

Running Executable

  1. Build the executable
go build
  1. Once you compiled the code into a executable, you can directly run the executable (./currencyconverter on Unix systems, currencyconverter.exe on Windows).