@@ -174,7 +174,7 @@ async fn retrieve_index_or_exit(options: &HashMap<&str, &str>, mp: Rc<MultiProgr
174174
175175fn print_error ( err_msg : & str , output_format : OutputFormat ) {
176176 match output_format {
177- OutputFormat :: Plaintext => println ! ( "{}" , err_msg) ,
177+ OutputFormat :: Plaintext => eprintln ! ( "{}" , err_msg) ,
178178 OutputFormat :: Json => println ! ( "{{\" error\" :\" {}\" }}" , err_msg) ,
179179 }
180180}
@@ -194,11 +194,10 @@ pub async fn download_apps(
194194 options : HashMap < & str , & str > ,
195195) {
196196 let mp = Rc :: new ( MultiProgress :: new ( ) ) ;
197- let mp_index = Rc :: clone ( & mp) ;
198- let index = retrieve_index_or_exit ( & options, mp_index, OutputFormat :: Plaintext ) . await ;
197+ let index = retrieve_index_or_exit ( & options, Rc :: clone ( & mp) , OutputFormat :: Plaintext ) . await ;
199198
200199 let app_arch = options. get ( "arch" ) . map ( |x| x. to_string ( ) ) ;
201- let ( fdroid_apps, repo_address) = match parse_json_for_download_information ( index, apps, app_arch. clone ( ) ) {
200+ let ( fdroid_apps, repo_address) = match parse_json_for_download_information ( index, apps, app_arch. clone ( ) , Rc :: clone ( & mp ) ) {
202201 Ok ( ( fdroid_apps, repo_address) ) => ( fdroid_apps, repo_address) ,
203202 Err ( _) => {
204203 println ! ( "Could not parse JSON of F-Droid package index. Exiting." ) ;
@@ -295,7 +294,7 @@ type DownloadInformation = (Vec<(String, Option<String>, String, Vec<u8>)>, Stri
295294/// flexible enough to parse either, and may work on future index versions as well. Since `sha256`
296295/// digests are checked before proceeding, I don't foresee this having an insecure failure mode, so
297296/// checking the index version and making the parsing overly brittle has no substantive advantage.
298- fn parse_json_for_download_information ( index : Value , apps : Vec < ( String , Option < String > ) > , app_arch : Option < String > ) -> Result < DownloadInformation , FDroidError > {
297+ fn parse_json_for_download_information ( index : Value , apps : Vec < ( String , Option < String > ) > , app_arch : Option < String > , mp_log : Rc < MultiProgress > ) -> Result < DownloadInformation , FDroidError > {
299298 let index_map = index. as_object ( ) . ok_or ( FDroidError :: Dummy ) ?;
300299 let repo_address = index_map
301300 . get ( "repo" ) . ok_or ( FDroidError :: Dummy ) ?
@@ -338,7 +337,7 @@ fn parse_json_for_download_information(index: Value, apps: Vec<(String, Option<S
338337 }
339338 }
340339 let arch_str = app_arch. as_ref ( ) . map_or ( "" . to_string ( ) , |x| format ! ( " {}" , x) ) ;
341- println ! ( "Could not find version {}{} of {}. Skipping..." , app_version. unwrap( ) , arch_str, app_id) ;
340+ mp_log . println ( format ! ( "Could not find version {}{} of {}. Skipping..." , app_version. unwrap( ) , arch_str, app_id) ) . unwrap ( ) ;
342341 return None ;
343342 } ,
344343 Some ( Value :: Object ( app_object) ) => {
@@ -380,7 +379,7 @@ fn parse_json_for_download_information(index: Value, apps: Vec<(String, Option<S
380379 }
381380 }
382381 } ,
383- _ => println ! ( "Could not find {} in package list. Skipping..." , app_id) ,
382+ _ => mp_log . println ( format ! ( "Could not find {} in package list. Skipping..." , app_id) ) . unwrap ( ) ,
384383 }
385384 None
386385 } ) . flatten ( ) . collect ( ) ;
@@ -446,7 +445,7 @@ fn parse_json_display_versions(index: Value, apps: Vec<(String, Option<String>)>
446445 _ => {
447446 match output_format {
448447 OutputFormat :: Plaintext => {
449- println ! ( "| Could not find {} in package list. Skipping..." , app_id) ;
448+ eprintln ! ( "| Could not find {} in package list. Skipping..." , app_id) ;
450449 } ,
451450 OutputFormat :: Json => {
452451 let mut app_root = HashMap :: new ( ) ;
0 commit comments