Skip to content

Commit

Permalink
feat: improve watch execution mode
Browse files Browse the repository at this point in the history
The `watch` command now requires user action to move to the next
exercise.

BREAKING CHANGE: this changes the behavior of `watch`.
  • Loading branch information
jrvidal committed Nov 11, 2019
1 parent a47a621 commit 2cdd612
Show file tree
Hide file tree
Showing 60 changed files with 309 additions and 12 deletions.
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ indicatif = "0.9.0"
console = "0.6.2"
notify = "4.0.0"
toml = "0.4.10"
regex = "1.1.6"
serde = {version = "1.0.10", features = ["derive"]}

[[bin]]
Expand All @@ -18,3 +19,4 @@ path = "src/main.rs"

[dev-dependencies]
assert_cmd = "0.11.0"
glob = "0.3.0"
2 changes: 2 additions & 0 deletions exercises/enums/enums1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// enums1.rs
// Make me compile! Scroll down for hints!

// I AM NOT DONE

#[derive(Debug)]
enum Message {
// TODO: define a few types of messages as used below
Expand Down
2 changes: 2 additions & 0 deletions exercises/enums/enums2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// enums2.rs
// Make me compile! Scroll down for hints

// I AM NOT DONE

#[derive(Debug)]
enum Message {
// TODO: define the different variants used below
Expand Down
2 changes: 2 additions & 0 deletions exercises/enums/enums3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// enums3.rs
// Address all the TODOs to make the tests pass!

// I AM NOT DONE

enum Message {
// TODO: implement the message variant types based on their usage below
}
Expand Down
2 changes: 2 additions & 0 deletions exercises/error_handling/errors1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// this function to have.
// Scroll down for hints!!!

// I AM NOT DONE

pub fn generate_nametag_text(name: String) -> Option<String> {
if name.len() > 0 {
Some(format!("Hi! My name is {}", name))
Expand Down
2 changes: 2 additions & 0 deletions exercises/error_handling/errors2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// There are at least two ways to implement this that are both correct-- but
// one is a lot shorter! Scroll down for hints to both ways.

// I AM NOT DONE

use std::num::ParseIntError;

pub fn total_cost(item_quantity: &str) -> Result<i32, ParseIntError> {
Expand Down
2 changes: 2 additions & 0 deletions exercises/error_handling/errors3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// `total_cost` function from the previous exercise. It's not working though!
// Why not? What should we do to fix it? Scroll for hints!

// I AM NOT DONE

use std::num::ParseIntError;

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions exercises/error_handling/errorsn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
//
// Scroll down for hints :)

// I AM NOT DONE

use std::error;
use std::fmt;
use std::io;
Expand Down
2 changes: 2 additions & 0 deletions exercises/error_handling/option1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// on `None`. Handle this in a more graceful way than calling `unwrap`!
// Scroll down for hints :)

// I AM NOT DONE

pub fn pop_too_much() -> bool {
let mut list = vec![3];

Expand Down
2 changes: 2 additions & 0 deletions exercises/error_handling/result1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// result1.rs
// Make this test pass! Scroll down for hints :)

// I AM NOT DONE

#[derive(PartialEq, Debug)]
struct PositiveNonzeroInteger(u64);

Expand Down
2 changes: 2 additions & 0 deletions exercises/functions/functions1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// functions1.rs
// Make me compile! Scroll down for hints :)

// I AM NOT DONE

fn main() {
call_me();
}
Expand Down
2 changes: 2 additions & 0 deletions exercises/functions/functions2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// functions2.rs
// Make me compile! Scroll down for hints :)

// I AM NOT DONE

fn main() {
call_me(3);
}
Expand Down
2 changes: 2 additions & 0 deletions exercises/functions/functions3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// functions3.rs
// Make me compile! Scroll down for hints :)

// I AM NOT DONE

fn main() {
call_me();
}
Expand Down
2 changes: 2 additions & 0 deletions exercises/functions/functions4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// This store is having a sale where if the price is an even number, you get
// 10 (money unit) off, but if it's an odd number, it's 3 (money unit) less.

// I AM NOT DONE

fn main() {
let original_price = 51;
println!("Your sale price is {}", sale_price(original_price));
Expand Down
2 changes: 2 additions & 0 deletions exercises/functions/functions5.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// functions5.rs
// Make me compile! Scroll down for hints :)

// I AM NOT DONE

fn main() {
let answer = square(3);
println!("The answer is {}", answer);
Expand Down
2 changes: 2 additions & 0 deletions exercises/if/if1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// if1.rs

// I AM NOT DONE

pub fn bigger(a: i32, b: i32) -> i32 {
// Complete this function to return the bigger number!
// Do not use:
Expand Down
2 changes: 2 additions & 0 deletions exercises/macros/macros1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// macros1.rs
// Make me compile! Scroll down for hints :)

// I AM NOT DONE

macro_rules! my_macro {
() => {
println!("Check out my macro!");
Expand Down
2 changes: 2 additions & 0 deletions exercises/macros/macros2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// macros2.rs
// Make me compile! Scroll down for hints :)

// I AM NOT DONE

fn main() {
my_macro!();
}
Expand Down
2 changes: 2 additions & 0 deletions exercises/macros/macros3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// macros3.rs
// Make me compile, without taking the macro out of the module! Scroll down for hints :)

// I AM NOT DONE

mod macros {
macro_rules! my_macro {
() => {
Expand Down
2 changes: 2 additions & 0 deletions exercises/macros/macros4.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// macros4.rs
// Make me compile! Scroll down for hints :)

// I AM NOT DONE

macro_rules! my_macro {
() => {
println!("Check out my macro!");
Expand Down
2 changes: 2 additions & 0 deletions exercises/modules/modules1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// modules1.rs
// Make me compile! Scroll down for hints :)

// I AM NOT DONE

mod sausage_factory {
fn make_sausage() {
println!("sausage!");
Expand Down
2 changes: 2 additions & 0 deletions exercises/modules/modules2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// modules2.rs
// Make me compile! Scroll down for hints :)

// I AM NOT DONE

mod delicious_snacks {
use self::fruits::PEAR as fruit;
use self::veggies::CUCUMBER as veggie;
Expand Down
2 changes: 2 additions & 0 deletions exercises/move_semantics/move_semantics1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// move_semantics1.rs
// Make me compile! Scroll down for hints :)

// I AM NOT DONE

fn main() {
let vec0 = Vec::new();

Expand Down
2 changes: 2 additions & 0 deletions exercises/move_semantics/move_semantics2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// move_semantics2.rs
// Make me compile without changing line 10! Scroll down for hints :)

// I AM NOT DONE

fn main() {
let vec0 = Vec::new();

Expand Down
2 changes: 2 additions & 0 deletions exercises/move_semantics/move_semantics3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// (no lines with multiple semicolons necessary!)
// Scroll down for hints :)

// I AM NOT DONE

fn main() {
let vec0 = Vec::new();

Expand Down
2 changes: 2 additions & 0 deletions exercises/move_semantics/move_semantics4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// in `fn main`, we instead create it within `fn fill_vec` and transfer the
// freshly created vector from fill_vec to its caller. Scroll for hints!

// I AM NOT DONE

fn main() {
let vec0 = Vec::new();

Expand Down
2 changes: 2 additions & 0 deletions exercises/primitive_types/primitive_types1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Fill in the rest of the line that has code missing!
// No hints, there's no tricks, just get used to typing these :)

// I AM NOT DONE

fn main() {
// Booleans (`bool`)

Expand Down
2 changes: 2 additions & 0 deletions exercises/primitive_types/primitive_types2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Fill in the rest of the line that has code missing!
// No hints, there's no tricks, just get used to typing these :)

// I AM NOT DONE

fn main() {
// Characters (`char`)

Expand Down
2 changes: 2 additions & 0 deletions exercises/primitive_types/primitive_types3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Create an array with at least 100 elements in it where the ??? is.
// Scroll down for hints!

// I AM NOT DONE

fn main() {
let a = ???

Expand Down
2 changes: 2 additions & 0 deletions exercises/primitive_types/primitive_types4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Get a slice out of Array a where the ??? is so that the `if` statement
// returns true. Scroll down for hints!!

// I AM NOT DONE

#[test]
fn main() {
let a = [1, 2, 3, 4, 5];
Expand Down
2 changes: 2 additions & 0 deletions exercises/primitive_types/primitive_types5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Destructure the `cat` tuple so that the println will work.
// Scroll down for hints!

// I AM NOT DONE

fn main() {
let cat = ("Furry McFurson", 3.5);
let /* your pattern here */ = cat;
Expand Down
2 changes: 2 additions & 0 deletions exercises/primitive_types/primitive_types6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// You can put this right into the `println!` where the ??? is.
// Scroll down for hints!

// I AM NOT DONE

fn main() {
let numbers = (1, 2, 3);
println!("The second number is {}", ???);
Expand Down
2 changes: 2 additions & 0 deletions exercises/standard_library_types/arc1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// somewhere. Try not to create any copies of the `numbers` Vec!
// Scroll down for hints :)

// I AM NOT DONE

use std::sync::Arc;
use std::thread;

Expand Down
2 changes: 2 additions & 0 deletions exercises/standard_library_types/iterators2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// Step 3. Apply the `capitalize_first` function again to a list, but try and ensure it returns a single string
// As always, there are hints below!

// I AM NOT DONE

pub fn capitalize_first(input: &str) -> String {
let mut c = input.chars();
match c.next() {
Expand Down
2 changes: 2 additions & 0 deletions exercises/standard_library_types/iterators3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// a major hint.
// Have fun :-)

// I AM NOT DONE

#[derive(Debug, PartialEq, Eq)]
pub enum DivisionError {
NotDivisible(NotDivisibleError),
Expand Down
2 changes: 2 additions & 0 deletions exercises/standard_library_types/iterators4.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// iterators4.rs

// I AM NOT DONE

pub fn factorial(num: u64) -> u64 {
// Complete this function to return factorial of num
// Do not use:
Expand Down
2 changes: 2 additions & 0 deletions exercises/strings/strings1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// strings1.rs
// Make me compile without changing the function signature! Scroll down for hints :)

// I AM NOT DONE

fn main() {
let answer = current_favorite_color();
println!("My current favorite color is {}", answer);
Expand Down
2 changes: 2 additions & 0 deletions exercises/strings/strings2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// strings2.rs
// Make me compile without changing the function signature! Scroll down for hints :)

// I AM NOT DONE

fn main() {
let word = String::from("green"); // Try not changing this line :)
if is_a_color_word(word) {
Expand Down
2 changes: 2 additions & 0 deletions exercises/structs/structs1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// structs1.rs
// Address all the TODOs to make the tests pass!

// I AM NOT DONE

struct ColorClassicStruct {
// TODO: Something goes here
}
Expand Down
2 changes: 2 additions & 0 deletions exercises/structs/structs2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Address all the TODOs to make the tests pass!
// No hints, just do it!

// I AM NOT DONE

#[derive(Debug)]
struct Order {
name: String,
Expand Down
Loading

0 comments on commit 2cdd612

Please sign in to comment.