@@ -9,7 +9,10 @@ use std::{
9
9
10
10
use async_std:: sync:: Arc ;
11
11
use clap:: { Args , CommandFactory , Parser , Subcommand } ;
12
- use color_eyre:: { eyre, eyre:: Context } ;
12
+ use color_eyre:: {
13
+ eyre:: { self , Context } ,
14
+ owo_colors:: OwoColorize ,
15
+ } ;
13
16
use completer:: enter_code;
14
17
use console:: { style, Term } ;
15
18
use futures:: { future:: Either , Future , FutureExt } ;
@@ -734,7 +737,7 @@ fn create_progress_bar(file_size: u64) -> ProgressBar {
734
737
pb. set_style (
735
738
ProgressStyle :: default_bar ( )
736
739
// .template("[{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({eta})")
737
- . template ( "[{elapsed_precise}] [{wide_bar}] {bytes}/{total_bytes} ({eta})" )
740
+ . template ( "[{elapsed_precise:.yellow }] [{wide_bar}] {bytes:.blue }/{total_bytes:.blue} {decimal_bytes_per_sec:.cyan} ({eta:.yellow })" )
738
741
. unwrap ( )
739
742
. progress_chars ( "#>-" ) ,
740
743
) ;
@@ -748,6 +751,7 @@ fn create_progress_handler(pb: ProgressBar) -> impl FnMut(u64, u64) {
748
751
pb. set_length ( total) ;
749
752
pb. enable_steady_tick ( std:: time:: Duration :: from_millis ( 250 ) ) ;
750
753
}
754
+
751
755
pb. set_position ( sent) ;
752
756
}
753
757
}
@@ -1020,12 +1024,12 @@ async fn receive_inner_v1(
1020
1024
|| util:: ask_user (
1021
1025
format ! (
1022
1026
"Receive file '{}' ({})?" ,
1023
- req. file_name( ) ,
1027
+ req. file_name( ) . green ( ) ,
1024
1028
match NumberPrefix :: binary( req. file_size( ) as f64 ) {
1025
1029
NumberPrefix :: Standalone ( bytes) => format!( "{} bytes" , bytes) ,
1026
- NumberPrefix :: Prefixed ( prefix, n) =>
1027
- format! ( "{:.1} {}B in size" , n , prefix . symbol ( ) ) ,
1028
- } ,
1030
+ NumberPrefix :: Prefixed ( prefix, n) => format! ( "{:.1} {}B" , n , prefix . symbol ( ) ) ,
1031
+ }
1032
+ . blue ( ) ,
1029
1033
) ,
1030
1034
true ,
1031
1035
)
@@ -1060,7 +1064,7 @@ async fn receive_inner_v1(
1060
1064
1061
1065
/* If there is a collision, ask whether to overwrite */
1062
1066
if !util:: ask_user (
1063
- format ! ( "Override existing file {}?" , file_path. display( ) ) ,
1067
+ format ! ( "Override existing file {}?" , file_path. display( ) ) . red ( ) ,
1064
1068
false ,
1065
1069
)
1066
1070
. await
@@ -1184,6 +1188,14 @@ async fn receive_inner_v2(
1184
1188
1185
1189
fn transit_handler ( info : TransitInfo ) {
1186
1190
tracing:: info!( "{info}" ) ;
1191
+ let mut term = Term :: stdout ( ) ;
1192
+
1193
+ let _ = writeln ! (
1194
+ term,
1195
+ "Connecting {} to {}" ,
1196
+ info. conn_type. bright_magenta( ) ,
1197
+ info. peer_addr. cyan( )
1198
+ ) ;
1187
1199
}
1188
1200
1189
1201
#[ cfg( test) ]
0 commit comments