File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ fn main() {
5454 . about ( "Returns a hint for the current exercise" )
5555 . arg ( Arg :: with_name ( "name" ) . required ( true ) . index ( 1 ) ) ,
5656 )
57+ . subcommand (
58+ SubCommand :: with_name ( "list" )
59+ . alias ( "l" )
60+ . about ( "Lists the exercises available in rustlings" )
61+ )
5762 . get_matches ( ) ;
5863
5964 if matches. subcommand_name ( ) . is_none ( ) {
@@ -88,6 +93,9 @@ fn main() {
8893 let exercises = toml:: from_str :: < ExerciseList > ( toml_str) . unwrap ( ) . exercises ;
8994 let verbose = matches. is_present ( "nocapture" ) ;
9095
96+ if matches. subcommand_matches ( "list" ) . is_some ( ) {
97+ exercises. iter ( ) . for_each ( |e| println ! ( "{}" , e. name) ) ;
98+ }
9199 if let Some ( ref matches) = matches. subcommand_matches ( "run" ) {
92100 let name = matches. value_of ( "name" ) . unwrap ( ) ;
93101
You can’t perform that action at this time.
0 commit comments