Last active
August 29, 2015 14:04
-
-
Save ype/52b0381a97efbd280b17 to your computer and use it in GitHub Desktop.
Ledger ZSH currency convert function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #LEDGER Quick Print Converted Accounts | |
| bal() { | |
| re='^[A-Za-z0-9]+$' | |
| if [[ "$1" == "GBP" ]] | |
| then | |
| perl /usr/local/Cellar/ledger/*/share/ledger/contrib/getquote.pl CAD GBP > ~/.currencydb | |
| elif [[ "$1" == "CAD" ]] | |
| then | |
| perl /usr/local/Cellar/ledger/*/share/ledger/contrib/getquote.pl GBP CAD > ~/.currencydb | |
| else | |
| echo "Not retrieving exchange rates" | |
| fi | |
| if ! [[ -z "$2" ]] | |
| then | |
| ledger "$2" --market="$1" --price-db=~/.currencydb | |
| else | |
| ledger "$1" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment