1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-11-08 09:09:17 +01:00

Highlight the solution file

This commit is contained in:
mo8it 2024-08-20 16:04:29 +02:00
parent 50f6e5232e
commit e7ba88f905
2 changed files with 20 additions and 18 deletions

@ -33,18 +33,21 @@ pub fn run(app_state: &mut AppState) -> Result<()> {
)?;
if let Some(solution_path) = app_state.current_solution_path()? {
println!(
"\nA solution file can be found at {}\n",
style(TerminalFileLink(&solution_path)).underlined().green(),
);
writeln!(
stdout,
"\n{} for comparison: {}\n",
"Solution".bold(),
style(TerminalFileLink(&solution_path)).underlined().cyan(),
)?;
}
match app_state.done_current_exercise(&mut stdout)? {
ExercisesProgress::AllDone => (),
ExercisesProgress::CurrentPending | ExercisesProgress::NewPending => println!(
ExercisesProgress::CurrentPending | ExercisesProgress::NewPending => writeln!(
stdout,
"Next exercise: {}",
app_state.current_exercise().terminal_link(),
),
)?,
}
Ok(())

@ -137,21 +137,20 @@ impl<'a> WatchState<'a> {
}
if self.done_status != DoneStatus::Pending {
writeln!(
self.writer,
"{}\n",
"Exercise done ✓
When you are done experimenting, enter `n` to move on to the next exercise 🦀"
.bold()
.green(),
)?;
}
writeln!(self.writer, "{}", "Exercise done ✓".bold().green())?;
if let DoneStatus::DoneWithSolution(solution_path) = &self.done_status {
writeln!(
self.writer,
"A solution file can be found at {}\n",
style(TerminalFileLink(solution_path)).underlined().green(),
"{} for comparison: {}",
"Solution".bold(),
style(TerminalFileLink(solution_path)).underlined().cyan(),
)?;
}
writeln!(
self.writer,
"When done experimenting, enter `n` to move on to the next exercise 🦀\n",
)?;
}