diff options
| author | Caleb Webber <caleb@codingthemsoftly.com> | 2020-11-10 12:36:19 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-10 18:36:19 +0100 |
| commit | 838f9f30083d0b23fd67503dcf0fbeca498e6647 (patch) | |
| tree | 1d829f473f94e08d90bbfd72fe66a5e9097d7e8d /src | |
| parent | 96347df9df294f01153b29d9ad4ba361f665c755 (diff) | |
feat: add "rustlings list" command
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index d0299e3..d04ad8f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,6 +54,11 @@ fn main() { .about("Returns a hint for the current exercise") .arg(Arg::with_name("name").required(true).index(1)), ) + .subcommand( + SubCommand::with_name("list") + .alias("l") + .about("Lists the exercises available in rustlings") + ) .get_matches(); if matches.subcommand_name().is_none() { @@ -88,6 +93,9 @@ fn main() { let exercises = toml::from_str::<ExerciseList>(toml_str).unwrap().exercises; let verbose = matches.is_present("nocapture"); + if matches.subcommand_matches("list").is_some() { + exercises.iter().for_each(|e| println!("{}", e.name)); + } if let Some(ref matches) = matches.subcommand_matches("run") { let name = matches.value_of("name").unwrap(); |
