From b4cc152c778c9f21f1e0a151b9d29760fbbf1476 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 29 Jan 2026 22:30:58 +0100 Subject: exercises: simplify the kind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As for now, all exercises I have follow the same pattern and there can be multiple workflows that can fit to it. Yes, maybe in the future it might be interesting to add other kinds of exercises, but for now I'm good and we can keep things simple. Signed-off-by: Miquel Sabaté Solà --- crates/cli/src/exercises.rs | 15 +-------------- crates/cli/src/run.rs | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 25 deletions(-) (limited to 'crates') diff --git a/crates/cli/src/exercises.rs b/crates/cli/src/exercises.rs index ef89a0c..8cac7b0 100644 --- a/crates/cli/src/exercises.rs +++ b/crates/cli/src/exercises.rs @@ -37,19 +37,6 @@ fn ask_for_exercise_based_on(exercise: Exercise) -> Result { return Err("the title is required".to_string()); } - let kinds = vec![ - ExerciseKind::Pensum, - ExerciseKind::Translation, - ExerciseKind::Transformation, - ExerciseKind::Numerical, - ]; - let Ok(kind) = Select::new("Kind:", kinds) - .with_starting_cursor(exercise.kind as usize) - .prompt() - else { - return Err("abort!".to_string()); - }; - let Ok(enunciate) = Editor::new("Enunciate:") .with_predefined_text(&exercise.enunciate) .with_file_extension(".md") @@ -89,7 +76,7 @@ fn ask_for_exercise_based_on(exercise: Exercise) -> Result { enunciate, solution, lessons, - kind, + kind: ExerciseKind::Simple, }) } diff --git a/crates/cli/src/run.rs b/crates/cli/src/run.rs index 86136aa..5f06870 100644 --- a/crates/cli/src/run.rs +++ b/crates/cli/src/run.rs @@ -508,18 +508,17 @@ fn run_exercises(exercises: Vec) -> bool { } for exercise in exercises { - let Ok(solution) = Editor::new( - format!("Exercise '{}' (kind: {}):", exercise.title, exercise.kind).as_str(), - ) - .with_predefined_text( - format!( - "---Enunciate: {}\n{}\n---!", - exercise.title, exercise.enunciate + let Ok(solution) = Editor::new(format!("Exercise '{}':", exercise.title).as_str()) + .with_predefined_text( + format!( + "---Enunciate: {}\n{}\n---!", + exercise.title, exercise.enunciate + ) + .as_str(), ) - .as_str(), - ) - .with_file_extension(".md") - .prompt() else { + .with_file_extension(".md") + .prompt() + else { return false; }; -- cgit v1.2.3