mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-06 18:13:29 +02:00
Highlight the solution file
This commit is contained in:
+9
-6
@@ -33,18 +33,21 @@ pub fn run(app_state: &mut AppState) -> Result<()> {
|
|||||||
)?;
|
)?;
|
||||||
|
|
||||||
if let Some(solution_path) = app_state.current_solution_path()? {
|
if let Some(solution_path) = app_state.current_solution_path()? {
|
||||||
println!(
|
writeln!(
|
||||||
"\nA solution file can be found at {}\n",
|
stdout,
|
||||||
style(TerminalFileLink(&solution_path)).underlined().green(),
|
"\n{} for comparison: {}\n",
|
||||||
);
|
"Solution".bold(),
|
||||||
|
style(TerminalFileLink(&solution_path)).underlined().cyan(),
|
||||||
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
match app_state.done_current_exercise(&mut stdout)? {
|
match app_state.done_current_exercise(&mut stdout)? {
|
||||||
ExercisesProgress::AllDone => (),
|
ExercisesProgress::AllDone => (),
|
||||||
ExercisesProgress::CurrentPending | ExercisesProgress::NewPending => println!(
|
ExercisesProgress::CurrentPending | ExercisesProgress::NewPending => writeln!(
|
||||||
|
stdout,
|
||||||
"Next exercise: {}",
|
"Next exercise: {}",
|
||||||
app_state.current_exercise().terminal_link(),
|
app_state.current_exercise().terminal_link(),
|
||||||
),
|
)?,
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
+10
-11
@@ -137,21 +137,20 @@ impl<'a> WatchState<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.done_status != DoneStatus::Pending {
|
if self.done_status != DoneStatus::Pending {
|
||||||
writeln!(
|
writeln!(self.writer, "{}", "Exercise done ✓".bold().green())?;
|
||||||
self.writer,
|
|
||||||
"{}\n",
|
|
||||||
"Exercise done ✓
|
|
||||||
When you are done experimenting, enter `n` to move on to the next exercise 🦀"
|
|
||||||
.bold()
|
|
||||||
.green(),
|
|
||||||
)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let DoneStatus::DoneWithSolution(solution_path) = &self.done_status {
|
if let DoneStatus::DoneWithSolution(solution_path) = &self.done_status {
|
||||||
writeln!(
|
writeln!(
|
||||||
self.writer,
|
self.writer,
|
||||||
"A solution file can be found at {}\n",
|
"{} for comparison: {}",
|
||||||
style(TerminalFileLink(solution_path)).underlined().green(),
|
"Solution".bold(),
|
||||||
|
style(TerminalFileLink(solution_path)).underlined().cyan(),
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
writeln!(
|
||||||
|
self.writer,
|
||||||
|
"When done experimenting, enter `n` to move on to the next exercise 🦀\n",
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user