File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff 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" )
Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments