1
0
mirror of https://github.com/Llewellynvdm/CoinRate.git synced 2024-11-25 03:37:34 +00:00

Added some formating to terminal output

This commit is contained in:
Llewellyn van der Merwe 2017-12-28 21:41:10 +02:00
parent 2e6c2d37ef
commit 99ad958c42
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
2 changed files with 16 additions and 9 deletions

View File

@ -28,8 +28,10 @@ VDMHOME=~/
# main function # main function
function main () { function main () {
echo "................................................................................................"
echo "...==========================================================================================..."
echoTweak "Getting the current price of $Currency in $Target" echoTweak "Getting the current price of $Currency in $Target"
echo echo "...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~..."
# get the price value # get the price value
value=$(get_Price "${API}${Currency}/${Target}") value=$(get_Price "${API}${Currency}/${Target}")
# set send key # set send key
@ -49,8 +51,11 @@ function main () {
then then
getTarget "$TargetBelowValue" "$value" 'setActionBelow' getTarget "$TargetBelowValue" "$value" 'setActionBelow'
fi fi
echo "...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~..."
# send Messages # send Messages
sendMessages sendMessages
echo "...==========================================================================================..."
echo "................................................................................................"
} }
function getTarget() { function getTarget() {
@ -118,9 +123,8 @@ function preform () {
# set message since we are above target value # set message since we are above target value
setMessage "$target_type" "$current_value" "$target_value" setMessage "$target_type" "$current_value" "$target_value"
else else
echoTweak "Nothing to report at this time! ($target_value)" echoTweak "Nothing to report at this time! ($target_value) "
fi fi
echo
} }
# set message # set message
@ -132,8 +136,8 @@ function setMessage () {
# build message # build message
message="${Currency} is ${target_type} ${target_value} ${Target} at ${current_value} ${Target}" message="${Currency} is ${target_type} ${target_value} ${Target} at ${current_value} ${Target}"
# first send to comand line # first send to comand line
echoTweak "${message} - ${Datetimenow}" echoTweak "${message} - ${Datetimenow} "
# is it show time # is it send time
sendTime "$target_type" "$target_value" sendTime "$target_type" "$target_value"
# set to messages # set to messages
setMessages "$message" "$target_type" "$target_value" setMessages "$message" "$target_type" "$target_value"
@ -216,11 +220,12 @@ function getActiveAboveMessage () {
echo $( echo "${keys}" | head -n1 ) echo $( echo "${keys}" | head -n1 )
} }
# show message in linux # show message in linux (will not work on server)
function showLinuxMessage () { function showLinuxMessage () {
# check if linux messages can be shown # check if linux messages can be shown
if (( "$LinuxNotice" == 1 )); then if (( "$LinuxNotice" == 1 )); then
zenity --text="$1" --info 2> /dev/null zenity --text="$1" --info 2> /dev/null
echoTweak "Linux Message was shown"
fi fi
} }
@ -229,6 +234,7 @@ function sendSMSMessage () {
# check if we should send SMS # check if we should send SMS
if (( "$SMS" == 1 )); then if (( "$SMS" == 1 )); then
smsMe "${messages}" smsMe "${messages}"
echoTweak "SMS Message was send"
fi fi
} }
@ -237,6 +243,7 @@ function sendTelegram () {
# check if we should send Telegram # check if we should send Telegram
if (( "$Telegram" == 1 )); then if (( "$Telegram" == 1 )); then
notifyMe "$1" notifyMe "$1"
echoTweak "Telegram Message was send"
fi fi
} }
@ -245,7 +252,7 @@ function sendTime () {
# set Args # set Args
local target_type="$1" local target_type="$1"
local target_value="$2" local target_value="$2"
# build key show time # build key send time
keySendTime=$(echo -n "${target_type}${target_value}${sendKey}" | md5sum) keySendTime=$(echo -n "${target_type}${target_value}${sendKey}" | md5sum)
# check if we should send # check if we should send
if (( "$sendSwitch" == 2 )) if (( "$sendSwitch" == 2 ))
@ -405,7 +412,7 @@ function echoTweak () {
fi fi
increaseBy=$((20+mainlen-chrlen)) increaseBy=$((20+mainlen-chrlen))
tweaked=$(repeat "$increaseBy") tweaked=$(repeat "$increaseBy")
echo -n "$echoMessage$tweaked" echo ".... $echoMessage $tweaked"
} }
# little repeater # little repeater

2
sms.sh
View File

@ -46,5 +46,5 @@ function smsMe() {
local password="${keyss[1]}" local password="${keyss[1]}"
local api_id="${keyss[2]}" local api_id="${keyss[2]}"
# send the sms's # send the sms's
curl -s --data "user=${username}&password=${password}&api_id=${api_id}&to=${to}&text=${message}" "https://api.clickatell.com/http/sendmsg" curl -s --data "user=${username}&password=${password}&api_id=${api_id}&to=${to}&text=${message}" "https://api.clickatell.com/http/sendmsg" > /dev/null
} }