@@ -76,7 +76,16 @@ fn run() -> Result<()> {
76
76
let locale = matches. value_of ( "locale" ) . unwrap ( ) ;
77
77
let locale = into_locale ( locale) ?;
78
78
79
- run_checkstyle ( exercise_path, output_path, locale) ?
79
+ run_checkstyle ( exercise_path, output_path, locale) ?;
80
+
81
+ let output = Output :: < ( ) > {
82
+ status : Status :: Successful ,
83
+ message : Some ( "ran checkstyle" . to_string ( ) ) ,
84
+ result : OutputResult :: ExecutedCommand ,
85
+ percent_done : 1.0 ,
86
+ data : None ,
87
+ } ;
88
+ print_output ( & output) ?
80
89
} else if let Some ( matches) = matches. subcommand_matches ( "compress-project" ) {
81
90
let exercise_path = matches. value_of ( "exercise-path" ) . unwrap ( ) ;
82
91
let exercise_path = Path :: new ( exercise_path) ;
@@ -97,6 +106,19 @@ fn run() -> Result<()> {
97
106
output_path. display( )
98
107
)
99
108
} ) ?;
109
+
110
+ let output = Output :: < ( ) > {
111
+ status : Status :: Successful ,
112
+ message : Some ( format ! (
113
+ "compressed project from {} to {}" ,
114
+ exercise_path. display( ) ,
115
+ output_path. display( )
116
+ ) ) ,
117
+ result : OutputResult :: ExecutedCommand ,
118
+ percent_done : 1.0 ,
119
+ data : None ,
120
+ } ;
121
+ print_output ( & output) ?
100
122
} else if let Some ( matches) = matches. subcommand_matches ( "extract-project" ) {
101
123
let archive_path = matches. value_of ( "archive-path" ) . unwrap ( ) ;
102
124
let archive_path = Path :: new ( archive_path) ;
@@ -106,6 +128,19 @@ fn run() -> Result<()> {
106
128
107
129
task_executor:: extract_project ( archive_path, output_path)
108
130
. with_context ( || format ! ( "Failed to extract project at {}" , output_path. display( ) ) ) ?;
131
+
132
+ let output = Output :: < ( ) > {
133
+ status : Status :: Successful ,
134
+ message : Some ( format ! (
135
+ "extracted project from {} to {}" ,
136
+ archive_path. display( ) ,
137
+ output_path. display( )
138
+ ) ) ,
139
+ result : OutputResult :: ExecutedCommand ,
140
+ percent_done : 1.0 ,
141
+ data : None ,
142
+ } ;
143
+ print_output ( & output) ?
109
144
} else if let Some ( matches) = matches. subcommand_matches ( "prepare-solutions" ) {
110
145
let exercise_path = matches. value_of ( "exercise-path" ) . unwrap ( ) ;
111
146
let exercise_path = Path :: new ( exercise_path) ;
@@ -120,6 +155,19 @@ fn run() -> Result<()> {
120
155
exercise_path. display( ) ,
121
156
)
122
157
} ) ?;
158
+
159
+ let output = Output :: < ( ) > {
160
+ status : Status :: Successful ,
161
+ message : Some ( format ! (
162
+ "prepared solutions for {} at {}" ,
163
+ exercise_path. display( ) ,
164
+ output_path. display( )
165
+ ) ) ,
166
+ result : OutputResult :: ExecutedCommand ,
167
+ percent_done : 1.0 ,
168
+ data : None ,
169
+ } ;
170
+ print_output ( & output) ?
123
171
} else if let Some ( matches) = matches. subcommand_matches ( "prepare-stubs" ) {
124
172
let exercise_path = matches. value_of ( "exercise-path" ) . unwrap ( ) ;
125
173
let exercise_path = Path :: new ( exercise_path) ;
@@ -135,6 +183,19 @@ fn run() -> Result<()> {
135
183
exercise_path. display( ) ,
136
184
)
137
185
} ) ?;
186
+
187
+ let output = Output :: < ( ) > {
188
+ status : Status :: Successful ,
189
+ message : Some ( format ! (
190
+ "prepared stubs for {} at {}" ,
191
+ exercise_path. display( ) ,
192
+ output_path. display( )
193
+ ) ) ,
194
+ result : OutputResult :: ExecutedCommand ,
195
+ percent_done : 1.0 ,
196
+ data : None ,
197
+ } ;
198
+ print_output ( & output) ?
138
199
} else if let Some ( matches) = matches. subcommand_matches ( "prepare-submission" ) {
139
200
let submission_path = matches. value_of ( "submission-path" ) . unwrap ( ) ;
140
201
let submission_path = Path :: new ( submission_path) ;
@@ -191,6 +252,19 @@ fn run() -> Result<()> {
191
252
stub_zip_path,
192
253
output_zip,
193
254
) ?;
255
+
256
+ let output = Output :: < ( ) > {
257
+ status : Status :: Successful ,
258
+ message : Some ( format ! (
259
+ "prepared submission for {} at {}" ,
260
+ submission_path. display( ) ,
261
+ output_path. display( )
262
+ ) ) ,
263
+ result : OutputResult :: ExecutedCommand ,
264
+ percent_done : 1.0 ,
265
+ data : None ,
266
+ } ;
267
+ print_output ( & output) ?
194
268
} else if let Some ( matches) = matches. subcommand_matches ( "run-tests" ) {
195
269
let exercise_path = matches. value_of ( "exercise-path" ) . unwrap ( ) ;
196
270
let exercise_path = Path :: new ( exercise_path) ;
@@ -216,6 +290,15 @@ fn run() -> Result<()> {
216
290
217
291
run_checkstyle ( exercise_path, checkstyle_output_path, locale) ?;
218
292
}
293
+
294
+ let output = Output {
295
+ status : Status :: Successful ,
296
+ message : Some ( format ! ( "ran tests for {}" , exercise_path. display( ) , ) ) ,
297
+ result : OutputResult :: ExecutedCommand ,
298
+ percent_done : 1.0 ,
299
+ data : Some ( test_result) ,
300
+ } ;
301
+ print_output ( & output) ?
219
302
} else if let Some ( matches) = matches. subcommand_matches ( "scan-exercise" ) {
220
303
let exercise_path = matches. value_of ( "exercise-path" ) . unwrap ( ) ;
221
304
let exercise_path = Path :: new ( exercise_path) ;
@@ -241,6 +324,15 @@ fn run() -> Result<()> {
241
324
. with_context ( || format ! ( "Failed to scan exercise at {}" , exercise_path. display( ) ) ) ?;
242
325
243
326
write_result_to_file_as_json ( & scan_result, output_path) ?;
327
+
328
+ let output = Output {
329
+ status : Status :: Successful ,
330
+ message : Some ( format ! ( "scanned exercise at {}" , exercise_path. display( ) , ) ) ,
331
+ result : OutputResult :: ExecutedCommand ,
332
+ percent_done : 1.0 ,
333
+ data : Some ( scan_result) ,
334
+ } ;
335
+ print_output ( & output) ?
244
336
} else if let Some ( matches) = matches. subcommand_matches ( "find-exercises" ) {
245
337
let exercise_path = matches. value_of ( "exercise-path" ) . unwrap ( ) ;
246
338
let exercise_path = Path :: new ( exercise_path) ;
@@ -265,6 +357,15 @@ fn run() -> Result<()> {
265
357
}
266
358
267
359
write_result_to_file_as_json ( & exercises, output_path) ?;
360
+
361
+ let output = Output {
362
+ status : Status :: Successful ,
363
+ message : Some ( format ! ( "found exercises at {}" , exercise_path. display( ) , ) ) ,
364
+ result : OutputResult :: ExecutedCommand ,
365
+ percent_done : 1.0 ,
366
+ data : Some ( exercises) ,
367
+ } ;
368
+ print_output ( & output) ?
268
369
} else if let Some ( matches) = matches. subcommand_matches ( "get-exercise-packaging-configuration" )
269
370
{
270
371
let exercise_path = matches. value_of ( "exercise-path" ) . unwrap ( ) ;
@@ -282,12 +383,33 @@ fn run() -> Result<()> {
282
383
} ) ?;
283
384
284
385
write_result_to_file_as_json ( & config, output_path) ?;
386
+
387
+ let output = Output {
388
+ status : Status :: Successful ,
389
+ message : Some ( format ! (
390
+ "created exercise packaging config from {}" ,
391
+ exercise_path. display( ) ,
392
+ ) ) ,
393
+ result : OutputResult :: ExecutedCommand ,
394
+ percent_done : 1.0 ,
395
+ data : Some ( config) ,
396
+ } ;
397
+ print_output ( & output) ?
285
398
} else if let Some ( matches) = matches. subcommand_matches ( "clean" ) {
286
399
let exercise_path = matches. value_of ( "exercise-path" ) . unwrap ( ) ;
287
400
let exercise_path = Path :: new ( exercise_path) ;
288
401
289
402
task_executor:: clean ( exercise_path)
290
403
. with_context ( || format ! ( "Failed to clean exercise at {}" , exercise_path. display( ) , ) ) ?;
404
+
405
+ let output = Output :: < ( ) > {
406
+ status : Status :: Successful ,
407
+ message : Some ( format ! ( "cleaned exercise at {}" , exercise_path. display( ) , ) ) ,
408
+ result : OutputResult :: ExecutedCommand ,
409
+ percent_done : 1.0 ,
410
+ data : None ,
411
+ } ;
412
+ print_output ( & output) ?
291
413
}
292
414
293
415
// core
0 commit comments