@@ -9,7 +9,8 @@ use self::config::ProjectsConfig;
99use self :: config:: { CourseConfig , Credentials , Exercise , TmcConfig } ;
1010use self :: error:: { InvalidTokenError , SandboxTestError } ;
1111use self :: output:: {
12- CombinedCourseData , ErrorData , Kind , Output , OutputData , OutputResult , Status , Warnings ,
12+ CombinedCourseData , DownloadOrUpdateCourseExercise , DownloadOrUpdateCourseExercisesResult ,
13+ ErrorData , Kind , Output , OutputData , OutputResult , Status , Warnings ,
1314} ;
1415use anyhow:: { Context , Result } ;
1516use clap:: { ArgMatches , Error , ErrorKind } ;
@@ -818,6 +819,8 @@ fn run_core(
818819
819820 let mut course_data = HashMap :: < String , Vec < ( String , String ) > > :: new ( ) ;
820821 let mut exercises_and_paths = vec ! [ ] ;
822+ let mut downloaded = vec ! [ ] ;
823+ let mut skipped = vec ! [ ] ;
821824 for exercise_detail in exercises_details {
822825 // check if the checksum is different from what's already on disk
823826 if let Some ( course_config) =
@@ -834,10 +837,20 @@ fn run_core(
834837 exercise_detail. course_name,
835838 exercise_detail. exercise_name
836839 ) ;
840+ skipped. push ( DownloadOrUpdateCourseExercise {
841+ course_slug : exercise_detail. course_name ,
842+ exercise_slug : exercise_detail. exercise_name ,
843+ } ) ;
837844 continue ;
838845 }
839846 }
840847 }
848+ // not skipped, will be downloaded
849+ // if any download fails, an error is returned instead, so it's ok to just push them to downloaded here
850+ downloaded. push ( DownloadOrUpdateCourseExercise {
851+ course_slug : exercise_detail. course_name . clone ( ) ,
852+ exercise_slug : exercise_detail. exercise_name . clone ( ) ,
853+ } ) ;
841854
842855 let target = ProjectsConfig :: get_exercise_download_target (
843856 & projects_dir,
@@ -873,12 +886,16 @@ fn run_core(
873886 } ;
874887 }
875888
876- let output = Output :: OutputData :: < ( ) > ( OutputData {
889+ let data = DownloadOrUpdateCourseExercisesResult {
890+ downloaded,
891+ skipped,
892+ } ;
893+ let output = Output :: OutputData ( OutputData {
877894 status : Status :: Finished ,
878895 message : None ,
879896 result : OutputResult :: RetrievedData ,
880897 percent_done : 1.0 ,
881- data : None ,
898+ data : Some ( data ) ,
882899 } ) ;
883900 print_output ( & output, pretty, & warnings) ?
884901 }
0 commit comments