Compare commits

...

8 Commits

@ -83,7 +83,7 @@ It will rerun the current exercise automatically every time you change the exerc
<details> <details>
<summary><strong>If detecting file changes in the <code>exercises/</code> directory fails…</strong> (<em>click to expand</em>)</summary> <summary><strong>If detecting file changes in the <code>exercises/</code> directory fails…</strong> (<em>click to expand</em>)</summary>
> You can add the **`--manual-run`** flag (`rustlings --manual-run`) to manually rerun the current exercise by entering `r` or `run` in the watch mode. > You can add the **`--manual-run`** flag (`rustlings --manual-run`) to manually rerun the current exercise by entering `r` (or `run`) in the watch mode.
> >
> Please [report the issue](https://github.com/rust-lang/rustlings/issues/new) with some information about your operating system and whether you run Rustlings in a container or virtual machine (e.g. WSL). > Please [report the issue](https://github.com/rust-lang/rustlings/issues/new) with some information about your operating system and whether you run Rustlings in a container or virtual machine (e.g. WSL).
@ -91,7 +91,7 @@ It will rerun the current exercise automatically every time you change the exerc
### Exercise List ### Exercise List
In the [watch mode](#watch-mode) (after launching `rustlings`), you can enter `l` or `list` to open the interactive exercise list. In the [watch mode](#watch-mode) (after launching `rustlings`), you can enter `l` (or `list`) to open the interactive exercise list.
The list allows you to… The list allows you to…

@ -1,11 +1,10 @@
// We sometimes encourage you to keep trying things on a given exercise, even // We sometimes encourage you to keep trying things on a given exercise, even
// after you already figured it out. If you got everything working and feel // after you already figured it out. If you got everything working and feel
// ready for the next exercise, remove the `I AM NOT DONE` comment below. // ready for the next exercise, enter `n` (or `next`) in the terminal.
// //
// If you're running this using `rustlings watch`: The exercise file will be // The exercise file will be reloaded when you change one of the lines below!
// reloaded when you change one of the lines below! Try adding a `println!` // Try adding a new `println!`.
// line, or try changing what it outputs in your terminal. Try removing a // Try removing a semicolon and see what happens in the terminal!
// semicolon and see what happens!
fn main() { fn main() {
println!("Hello and"); println!("Hello and");
@ -22,5 +21,6 @@ fn main() {
println!("solve the exercises. Good luck!"); println!("solve the exercises. Good luck!");
println!(); println!();
println!("The file of this exercise is `exercises/00_intro/intro1.rs`. Have a look!"); println!("The file of this exercise is `exercises/00_intro/intro1.rs`. Have a look!");
println!("The current exercise path is shown under the progress bar in the watch mode."); println!("The current exercise path will be always shown under the progress bar.");
println!("You can click on the path to open the exercise file in your editor.");
} }

@ -1,32 +1,26 @@
format_version = 1 format_version = 1
welcome_message = """Is this your first time? Don't worry, Rustlings was made for beginners! We are welcome_message = """Is this your first time? Don't worry, Rustlings is made for beginners!
going to teach you a lot of things about Rust, but before we can get We are going to teach you a lot of things about Rust, but before we can
started, here's a couple of notes about how Rustlings operates: get started, here are some notes about how Rustlings operates:
1. The central concept behind Rustlings is that you solve exercises. These 1. The central concept behind Rustlings is that you solve exercises. These
exercises usually have some sort of syntax error in them, which will cause exercises usually contain some compiler or logic errors which cause the
them to fail compilation or testing. Sometimes there's a logic error instead exercise to fail compilation or testing. It's your job to find all errors
of a syntax error. No matter what error, it's your job to find it and fix it! and fix them!
You'll know when you fixed it because then, the exercise will compile and 2. Make sure to have your editor open in the `rustlings/` directory. Rustlings
Rustlings will be able to move on to the next exercise. will show you the path of the current exercise under the progress bar. Open
2. If you run Rustlings in watch mode (which we recommend), it'll automatically the exercise file in your editor, fix errors and save the file. Rustlings will
start with the first exercise. Don't get confused by an error message popping automatically detect the file change and rerun the exercise. If all errors are
up as soon as you run Rustlings! This is part of the exercise that you're fixed, Rustlings will ask you to move on to the next exercise.
supposed to solve, so open the exercise file in an editor and start your 3. If you're stuck on an exercise, enter `h` (or `hint`) to show a hint.
detective work!
3. If you're stuck on an exercise, there is a helpful hint you can view by typing
'hint' (in watch mode), or running `rustlings hint exercise_name`.
4. If an exercise doesn't make sense to you, feel free to open an issue on GitHub! 4. If an exercise doesn't make sense to you, feel free to open an issue on GitHub!
(https://github.com/rust-lang/rustlings/issues/new). We look at every issue, (https://github.com/rust-lang/rustlings). We look at every issue, and sometimes,
and sometimes, other learners do too so you can help each other out! other learners do too so you can help each other out!
Got all that? Great! To get started, run `rustlings watch` in order to get the first exercise.
Make sure to have your editor open in the `rustlings` directory!
""" """
final_message = """We hope you enjoyed learning about the various aspects of Rust! final_message = """We hope you enjoyed learning about the various aspects of Rust!
If you noticed any issues, please don't hesitate to report them to our repo. If you noticed any issues, don't hesitate to report them on Github.
You can also contribute your own exercises to help the greater community! You can also contribute your own exercises to help the greater community!
Before reporting an issue or contributing, please read our guidelines: Before reporting an issue or contributing, please read our guidelines:
@ -41,9 +35,7 @@ name = "intro1"
dir = "00_intro" dir = "00_intro"
test = false test = false
# TODO: Fix hint # TODO: Fix hint
hint = """ hint = """Enter `n` (or `next`) followed by ENTER to move on to the next exercise"""
Remove the `I AM NOT DONE` comment in the `exercises/intro00/intro1.rs` file
to move on to the next exercise."""
[[exercises]] [[exercises]]
name = "intro2" name = "intro2"

@ -42,7 +42,7 @@ pub fn list(app_state: &mut AppState) -> Result<()> {
ui_state.message.clear(); ui_state.message.clear();
match key.code { match key.code {
KeyCode::Char('q') => break, KeyCode::Esc | KeyCode::Char('q') => break,
KeyCode::Down | KeyCode::Char('j') => ui_state.select_next(), KeyCode::Down | KeyCode::Char('j') => ui_state.select_next(),
KeyCode::Up | KeyCode::Char('k') => ui_state.select_previous(), KeyCode::Up | KeyCode::Char('k') => ui_state.select_previous(),
KeyCode::Home | KeyCode::Char('g') => ui_state.select_first(), KeyCode::Home | KeyCode::Char('g') => ui_state.select_first(),

@ -194,7 +194,7 @@ impl<'a> UiState<'a> {
let message = if self.message.is_empty() { let message = if self.message.is_empty() {
// Help footer. // Help footer.
Span::raw( Span::raw(
"↓/j ↑/k home/g end/G │ filter <d>one/<p>ending │ <r>eset │ <c>ontinue at │ <q>uit", "↓/j ↑/k home/g end/G │ <c>ontinue at │ <r>eset │ filter <d>one/<p>ending │ <q>uit",
) )
} else { } else {
self.message.as_str().light_blue() self.message.as_str().light_blue()

@ -124,5 +124,5 @@ The automatic detection of exercise file changes failed :(
Please try running `rustlings` again. Please try running `rustlings` again.
If you keep getting this error, run `rustlings --manual-run` to deactivate the file watcher. If you keep getting this error, run `rustlings --manual-run` to deactivate the file watcher.
You need to manually trigger running the current exercise using `r` or `run` then. You need to manually trigger running the current exercise using `r` (or `run`) then.
"; ";

@ -130,7 +130,7 @@ impl<'a> WatchState<'a> {
self.writer, self.writer,
"{}\n", "{}\n",
"Exercise done "Exercise done
When you are done experimenting, enter `n` or `next` to go to the next exercise 🦀" When you are done experimenting, enter `n` (or `next`) to move on to the next exercise 🦀"
.bold() .bold()
.green(), .green(),
)?; )?;

@ -1,5 +1,4 @@
use assert_cmd::prelude::*; use assert_cmd::prelude::*;
use predicates::boolean::PredicateBooleanExt;
use std::process::Command; use std::process::Command;
#[test] #[test]
@ -110,8 +109,7 @@ fn run_compile_exercise_does_not_prompt() {
.args(["run", "pending_exercise"]) .args(["run", "pending_exercise"])
.current_dir("tests/fixture/state") .current_dir("tests/fixture/state")
.assert() .assert()
.code(0) .code(0);
.stdout(predicates::str::contains("I AM NOT DONE").not());
} }
#[test] #[test]
@ -121,8 +119,7 @@ fn run_test_exercise_does_not_prompt() {
.args(["run", "pending_test_exercise"]) .args(["run", "pending_test_exercise"])
.current_dir("tests/fixture/state") .current_dir("tests/fixture/state")
.assert() .assert()
.code(0) .code(0);
.stdout(predicates::str::contains("I AM NOT DONE").not());
} }
#[test] #[test]

Loading…
Cancel
Save