ticker now properly scales to cols and has a dev option to just be a printf

This commit is contained in:
Nicole O'Connor
2021-08-24 19:10:32 -07:00
parent cfb6228116
commit c520435502
3 changed files with 11 additions and 9 deletions

View File

@@ -2,4 +2,5 @@
# ESPECIALLY DON'T EDIT this file if you're using zeesh near nuclear reactor
# control software for whatever unimaginable reason.
_zeeshdev_ignore_updates=0
_zeeshdev_ignore_updates=0
_zeeshdev_ticker_newlines=0

View File

@@ -1,11 +1,14 @@
function ticker_message () {
# TODO: get cols and scale
printf "\r \r"
cols=$(stty -a | grep -Po '(?<=columns )\d+' | tr -d "\n")
printf "$@"
function ticker_message () {
if [[ $_zeeshdev_ticker_newlines == 0 ]]; then
printf "\r${(l:$cols:: :)A}\r"
printf "$@"
else
printf "$@\n"
fi
}
function ticker_finish () {
# TODO: get cols and scale
printf "\r \r"
[[ $_zeeshdev_ticker_newlines == 0 ]] && printf "\r${(l:$cols:: :)A}\r"
}