@@ -17,7 +17,7 @@ use crate::utils::is_valid_julia_path;
17
17
use anyhow:: { anyhow, bail, Context , Error , Result } ;
18
18
use bstr:: ByteSlice ;
19
19
use bstr:: ByteVec ;
20
- use console:: style;
20
+ use console:: { colors_enabled , style} ;
21
21
#[ cfg( not( target_os = "freebsd" ) ) ]
22
22
use flate2:: read:: GzDecoder ;
23
23
use indicatif:: { ProgressBar , ProgressStyle } ;
92
92
Ok ( ( ) )
93
93
}
94
94
95
+ fn bar_style ( ) -> ProgressStyle {
96
+ let pchars = if colors_enabled ( ) {
97
+ "━╸━"
98
+ } else {
99
+ "━╸ "
100
+ } ;
101
+
102
+ ProgressStyle :: default_bar ( )
103
+ . template ( "{prefix:.cyan.bold}: {bar:.cyan/black.bright} {bytes}/{total_bytes} eta: {eta}" )
104
+ . unwrap ( )
105
+ . progress_chars ( pchars)
106
+ }
107
+
95
108
#[ cfg( not( windows) ) ]
96
109
pub fn download_extract_sans_parent (
97
110
url : & str ,
@@ -110,14 +123,7 @@ pub fn download_extract_sans_parent(
110
123
} ;
111
124
112
125
pb. set_prefix ( " Downloading" ) ;
113
- pb. set_style (
114
- ProgressStyle :: default_bar ( )
115
- . template (
116
- "{prefix:.cyan.bold}: {bar:.cyan/black.bright} {bytes}/{total_bytes} eta: {eta}" ,
117
- )
118
- . unwrap ( )
119
- . progress_chars ( "━╸━" ) ,
120
- ) ;
126
+ pb. set_style ( bar_style ( ) ) ;
121
127
122
128
let last_modified = match response
123
129
. headers ( )
@@ -211,12 +217,7 @@ pub fn download_extract_sans_parent(
211
217
} ;
212
218
213
219
pb. set_prefix ( " Downloading" ) ;
214
- pb. set_style (
215
- ProgressStyle :: default_bar ( )
216
- . template ( "{prefix:.cyan.bold}: {bar:.cyan/white} {bytes}/{total_bytes} eta: {eta}" )
217
- . unwrap ( )
218
- . progress_chars ( "━╸━" ) ,
219
- ) ;
220
+ pb. set_style ( bar_style ( ) ) ;
220
221
221
222
let response_with_pb = pb. wrap_read ( DataReaderWrap ( reader) ) ;
222
223
0 commit comments