summaryrefslogtreecommitdiff
path: root/src/run.rs
diff options
context:
space:
mode:
authorMo <76752051+mo8it@users.noreply.github.com>2024-04-24 02:56:20 +0200
committerGitHub <noreply@github.com>2024-04-24 02:56:20 +0200
commit53fdb9044d54dbdf5f0aa6c309cd285829a04b3a (patch)
treeb45b6f11597130690232b2eaa9621f25ecf98200 /src/run.rs
parent86684b7fc9dd5e8bedad6056565645d1d980925c (diff)
parent8a085a0a85c759029cd57c28364867bde817e738 (diff)
Merge pull request #1955 from rust-lang/solutions
Solutions
Diffstat (limited to 'src/run.rs')
-rw-r--r--src/run.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/run.rs b/src/run.rs
index 863b584..a2b6972 100644
--- a/src/run.rs
+++ b/src/run.rs
@@ -1,8 +1,11 @@
use anyhow::{bail, Result};
-use crossterm::style::Stylize;
+use crossterm::style::{style, Stylize};
use std::io::{self, Write};
-use crate::app_state::{AppState, ExercisesProgress};
+use crate::{
+ app_state::{AppState, ExercisesProgress},
+ terminal_link::TerminalFileLink,
+};
pub fn run(app_state: &mut AppState) -> Result<()> {
let exercise = app_state.current_exercise();
@@ -29,6 +32,13 @@ pub fn run(app_state: &mut AppState) -> Result<()> {
exercise.path.green(),
))?;
+ 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(),
+ );
+ }
+
match app_state.done_current_exercise(&mut stdout)? {
ExercisesProgress::AllDone => (),
ExercisesProgress::Pending => println!(