Skip to content

Commit e7ba88f

Browse files
committed
Highlight the solution file
1 parent 50f6e52 commit e7ba88f

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

src/run.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,21 @@ pub fn run(app_state: &mut AppState) -> Result<()> {
3333
)?;
3434

3535
if let Some(solution_path) = app_state.current_solution_path()? {
36-
println!(
37-
"\nA solution file can be found at {}\n",
38-
style(TerminalFileLink(&solution_path)).underlined().green(),
39-
);
36+
writeln!(
37+
stdout,
38+
"\n{} for comparison: {}\n",
39+
"Solution".bold(),
40+
style(TerminalFileLink(&solution_path)).underlined().cyan(),
41+
)?;
4042
}
4143

4244
match app_state.done_current_exercise(&mut stdout)? {
4345
ExercisesProgress::AllDone => (),
44-
ExercisesProgress::CurrentPending | ExercisesProgress::NewPending => println!(
46+
ExercisesProgress::CurrentPending | ExercisesProgress::NewPending => writeln!(
47+
stdout,
4548
"Next exercise: {}",
4649
app_state.current_exercise().terminal_link(),
47-
),
50+
)?,
4851
}
4952

5053
Ok(())

src/watch/state.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,21 +137,20 @@ impl<'a> WatchState<'a> {
137137
}
138138

139139
if self.done_status != DoneStatus::Pending {
140-
writeln!(
141-
self.writer,
142-
"{}\n",
143-
"Exercise done ✓
144-
When you are done experimenting, enter `n` to move on to the next exercise 🦀"
145-
.bold()
146-
.green(),
147-
)?;
148-
}
140+
writeln!(self.writer, "{}", "Exercise done ✓".bold().green())?;
141+
142+
if let DoneStatus::DoneWithSolution(solution_path) = &self.done_status {
143+
writeln!(
144+
self.writer,
145+
"{} for comparison: {}",
146+
"Solution".bold(),
147+
style(TerminalFileLink(solution_path)).underlined().cyan(),
148+
)?;
149+
}
149150

150-
if let DoneStatus::DoneWithSolution(solution_path) = &self.done_status {
151151
writeln!(
152152
self.writer,
153-
"A solution file can be found at {}\n",
154-
style(TerminalFileLink(solution_path)).underlined().green(),
153+
"When done experimenting, enter `n` to move on to the next exercise 🦀\n",
155154
)?;
156155
}
157156

0 commit comments

Comments
 (0)