Skip to content

Commit 0c459df

Browse files
committed
get-exercise-details
1 parent 3d1b099 commit 0c459df

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tmc-langs-cli/src/app.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ pub fn create_app() -> App<'static, 'static> {
270270
.required(true)
271271
.takes_value(true)))
272272

273+
.subcommand(SubCommand::with_name("get-exercise-details")
274+
.about("Get exercise details.")
275+
.arg(Arg::with_name("exercise-id")
276+
.help("The ID of the exercise.")
277+
.long("exercise-id")
278+
.required(true)
279+
.takes_value(true)))
280+
273281
.subcommand(SubCommand::with_name("paste")
274282
.about("Send exercise to pastebin with comment.")
275283
.arg(Arg::with_name("submission-url")

tmc-langs-cli/src/main.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,21 @@ fn run() -> Result<()> {
676676
.get_course_exercises(course_id)
677677
.context("Failed to get course")?;
678678

679+
let output = Output {
680+
status: Status::Successful,
681+
message: None,
682+
result: OutputResult::RetrievedData,
683+
percent_done: 1.0,
684+
data: Some(course),
685+
};
686+
print_output(&output)?;
687+
} else if let Some(matches) = matches.subcommand_matches("get-exercise-details") {
688+
let exercise_id = matches.value_of("exercise-id").unwrap();
689+
let exercise_id = into_usize(exercise_id)?;
690+
let course = core
691+
.get_exercise_details(exercise_id)
692+
.context("Failed to get course")?;
693+
679694
let output = Output {
680695
status: Status::Successful,
681696
message: None,

0 commit comments

Comments
 (0)