Skip to content

Commit ef345b8

Browse files
committed
re-added progress messages for downloading exercises
1 parent 505e567 commit ef345b8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tmc-langs/src/lib.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ pub fn download_or_update_course_exercises(
160160
);
161161

162162
let exercises_details = client.get_exercises_details(exercises)?;
163+
let exercises_len = exercises_details.len();
164+
start_stage(
165+
exercises_len * 2 + 1, // each download progresses at 2 points, plus the final finishing step
166+
format!("Downloading {} exercises", exercises_len),
167+
);
163168

164169
let mut projects_config = ProjectsConfig::load(projects_dir)?;
165170

@@ -261,6 +266,17 @@ pub fn download_or_update_course_exercises(
261266

262267
let exercise_download_result = || -> Result<(), LangsError> {
263268
let zip_file = file_util::named_temp_file()?;
269+
270+
let target_exercise = match download_target {
271+
DownloadTarget::Template { ref target, .. } => target,
272+
DownloadTarget::Submission { ref target, .. } => target,
273+
};
274+
progress_stage(format!(
275+
"Downloading exercise {} to '{}'",
276+
target_exercise.id,
277+
target_exercise.path.display(),
278+
));
279+
264280
match &download_target {
265281
DownloadTarget::Template { target, .. } => {
266282
client.download_exercise(target.id, zip_file.path())?;
@@ -288,6 +304,13 @@ pub fn download_or_update_course_exercises(
288304
extract_project(&zip_file, &target.path, false)?;
289305
}
290306
}
307+
308+
progress_stage(format!(
309+
"Downloaded exercise {} to '{}'",
310+
target_exercise.id,
311+
target_exercise.path.display(),
312+
));
313+
291314
Ok(())
292315
}();
293316

@@ -355,6 +378,12 @@ pub fn download_or_update_course_exercises(
355378
};
356379
}
357380

381+
finish_stage(format!(
382+
"Successfully downloaded {} out of {} exercises.",
383+
successful.len(),
384+
exercises_len
385+
));
386+
358387
let downloaded = successful
359388
.into_iter()
360389
.map(|t| match t {

0 commit comments

Comments
 (0)