Skip to content

Commit

Permalink
feat: add "rustlings list" command
Browse files Browse the repository at this point in the history
  • Loading branch information
seeplusplus committed Nov 10, 2020
1 parent 96347df commit 838f9f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 838f9f3

Please sign in to comment.