File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ function progress::enabled() {
4+ env::is_progress_bar_enabled && ! parallel::is_enabled
5+ }
6+
37function progress::init() {
48 export PROGRESS_TOTAL=$1
59 # Track the last rendered progress state so the bar can be redrawn
610 export PROGRESS_CURRENT=0
711
8- if parallel::is_enabled || [[ ! -t 1 ]] || ! env::is_progress_bar_enabled; then
9- _PROGRESS_ENABLED=false
10- else
11- _PROGRESS_ENABLED=true
12+ if progress::enabled ; then
1213 progress::render 0 " $PROGRESS_TOTAL "
1314 fi
1415}
@@ -19,7 +20,7 @@ function progress::render() {
1920
2021 PROGRESS_CURRENT=$current
2122
22- if [[ " $_PROGRESS_ENABLED " != true ]] ; then
23+ if ! progress::enabled ; then
2324 return
2425 fi
2526
@@ -60,7 +61,7 @@ function progress::render() {
6061}
6162
6263function progress::finish() {
63- if [[ " $_PROGRESS_ENABLED " != true ]] ; then
64+ if ! progress::enabled ; then
6465 return
6566 fi
6667
@@ -76,7 +77,7 @@ function progress::finish() {
7677
7778# Re-render the last progress bar if progress display is enabled
7879function progress::refresh() {
79- if [[ " $_PROGRESS_ENABLED " == true ]] ; then
80+ if progress::enabled ; then
8081 progress::render " ${PROGRESS_CURRENT:- } " " ${PROGRESS_TOTAL:- } "
8182 fi
8283}
You can’t perform that action at this time.
0 commit comments