1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-09-16 10:51:42 +02:00

Show the current exercise path

This commit is contained in:
mo8it 2024-04-10 14:29:31 +02:00
parent 62e92476e6
commit a59acf8835
2 changed files with 7 additions and 1 deletions

View File

@ -49,7 +49,7 @@ pub fn progress_bar(progress: u16, total: u16, line_width: u16) -> Result<String
write!(line, "{}", red_part.red()).unwrap();
}
write!(line, "] {progress:>3}/{total} exercises").unwrap();
writeln!(line, "] {progress:>3}/{total} exercises").unwrap();
Ok(line)
}

View File

@ -149,6 +149,12 @@ You can keep working on this exercise or jump into the next one by removing the
let progress_bar = progress_bar(self.progress, self.exercises.len() as u16, line_width)?;
self.writer.write_all(progress_bar.as_bytes())?;
self.writer.write_all(b"Current exercise: ")?;
self.writer.write_fmt(format_args!(
"{}",
self.exercise.path.to_string_lossy().bold()
))?;
self.show_prompt()?;
Ok(())