From 689e2015a05886c08a21f66d5d4567ab21787836 Mon Sep 17 00:00:00 2001 From: deicidus Date: Fri, 16 Jun 2023 09:10:32 -0700 Subject: [PATCH] status displays color correctly --- spells/menu/bitcoin/bitcoin-status | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spells/menu/bitcoin/bitcoin-status b/spells/menu/bitcoin/bitcoin-status index 8e0a5d6..89cec8f 100755 --- a/spells/menu/bitcoin/bitcoin-status +++ b/spells/menu/bitcoin/bitcoin-status @@ -38,13 +38,13 @@ get_sync_status() { # Returns colored status message get_status() { if is-bitcoin-installed; then - if is-bitcoin-running; then + if is-bitcoin-running > /dev/null; then running_status="running" sync_status=$(get_sync_status) if [ "$sync_status" = "synced" ]; then install_status="installed, $running_status, synced" elif [ "$sync_status" = "syncing" ]; then - progress=$(bitcoin-cli getblockchaininfo | grep 'progress' | awk -F":" '{gsub(/,/, "", $2); print int($2*100)}') + progress=$(bitcoin-cli getblockchaininfo | grep 'progress' | awk -F":" '{gsub(/,/, "", $2); printf "%.1f", $2*100}') install_status="installed, $running_status, syncing $progress%" elif [ "$sync_status" = "unknown" ]; then install_status="installed, $running_status, not synced" @@ -58,7 +58,7 @@ get_status() { install_status="not installed" fi - printf "%s\n" "$(color_for_status "$install_status")$install_status${RESET}" + printf "$(color_for_status "$install_status")$install_status${RESET}\n" } get_status \ No newline at end of file