From 04e80e5ceadee536ccfe0315c835ac4193a32f84 Mon Sep 17 00:00:00 2001 From: davidovski Date: Sun, 13 Feb 2022 22:39:57 +0000 Subject: made hbar write to current line by default --- src/hbar.c | 4 ++-- test/hbar.sh | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/hbar.c b/src/hbar.c index 27ae437..7d971c4 100644 --- a/src/hbar.c +++ b/src/hbar.c @@ -29,7 +29,7 @@ int main (int argc, char **argv) { char *unit = ""; int total = 0; int completed = 0; - int line = 1; + int line = 0; bool terminate = false; char *color = DEFAULT_COLOR; @@ -114,7 +114,7 @@ int main (int argc, char **argv) { printf("\033[%dB", line, 0); } if (terminate) { - printf(RESET "\r"); + printf(RESET "\n"); } diff --git a/test/hbar.sh b/test/hbar.sh index ab0c812..80f6a9c 100755 --- a/test/hbar.sh +++ b/test/hbar.sh @@ -5,19 +5,17 @@ TEXT="Hello there" UNIT="mb" MAX=100 - -echo for x in $(seq $MAX); do ${HBAR} -T "${TEXT}" -u ${UNIT} $x $MAX sleep 0.01 done ${HBAR} -t -T "${TEXT}" -u ${UNIT} $x $MAX -echo 1; echo 2 +hbar for x in $(seq $MAX); do - ${HBAR} -l 1 -T "${TEXT}" -u ${UNIT} $((MAX - x)) $MAX - ${HBAR} -l 2 -T "${TEXT}" -u ${UNIT} $x $MAX + ${HBAR} -l 0 -T "${TEXT}" -u ${UNIT} $((MAX - x)) $MAX + ${HBAR} -l 1 -T "${TEXT}" -u ${UNIT} $x $MAX sleep 0.01 done -${HBAR} -l 1 -t -T "${TEXT}" -u ${UNIT} $((MAX-x)) $MAX -${HBAR} -l 2 -t -T "${TEXT}" -u ${UNIT} $x $MAX +${HBAR} -l 0 -t -T "${TEXT}" -u ${UNIT} $((MAX-x)) $MAX +${HBAR} -l 1 -t -T "${TEXT}" -u ${UNIT} $x $MAX -- cgit v1.2.1