Adding new rates.sx feature to cryptocurrency

This commit is contained in:
Alex Epstein 2018-10-19 18:35:35 -07:00
parent bb2103081d
commit 40df20fb85
1 changed files with 12 additions and 4 deletions

View File

@ -254,11 +254,14 @@ EOF
while getopts "of:uvh" opt; do
while getopts "c:of:uvh" opt; do
case "$opt" in
\?) echo "Invalid option: -$OPTARG" >&2
exit 1
;;
c)
currency=$OPTARG
;;
h) usage
exit 0
;;
@ -305,8 +308,13 @@ fi
getConfiguredClient || exit 1
checkInternet || exit 1
link="rate.sx"
if [[ $fiat =~ [a-zA-Z] ]]; then
httpGet $fiat.rate.sx
else
httpGet rate.sx
link="$fiat.$link"
fi
if [[ $currency =~ [a-zA-Z] ]]; then
link="$link/$currency"
fi
httpGet $link