Compare commits

...

8 Commits

@ -83,7 +83,7 @@ It will rerun the current exercise automatically every time you change the exerc
<details>
<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).
@ -91,7 +91,7 @@ It will rerun the current exercise automatically every time you change the exerc
### 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…

@ -1,11 +1,10 @@
// 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
// 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
// reloaded when you change one of the lines below! Try adding a `println!`
// line, or try changing what it outputs in your terminal. Try removing a
// semicolon and see what happens!
// The exercise file will be reloaded when you change one of the lines below!
// Try adding a new `println!`.
// Try removing a semicolon and see what happens in the terminal!
fn main() {
println!("Hello and");
@ -22,5 +21,6 @@ fn main() {
println!("solve the exercises. Good luck!");
println!();
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
welcome_message = """Is this your first time? Don't worry, Rustlings was made for beginners! We are
going to teach you a lot of things about Rust, but before we can get
started, here's a couple of notes about how Rustlings operates:
welcome_message = """Is this your first time? Don't worry, Rustlings is made for beginners!
We are going to teach you a lot of things about Rust, but before we can
get started, here are some notes about how Rustlings operates:
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
them to fail compilation or testing. Sometimes there's a logic error instead
of a syntax error. No matter what error, it's your job to find it and fix it!
You'll know when you fixed it because then, the exercise will compile and
Rustlings will be able to move on to the next exercise.
2. If you run Rustlings in watch mode (which we recommend), it'll automatically
start with the first exercise. Don't get confused by an error message popping
up as soon as you run Rustlings! This is part of the exercise that you're
supposed to solve, so open the exercise file in an editor and start your
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`.
exercises usually contain some compiler or logic errors which cause the
exercise to fail compilation or testing. It's your job to find all errors
and fix them!
2. Make sure to have your editor open in the `rustlings/` directory. Rustlings
will show you the path of the current exercise under the progress bar. Open
the exercise file in your editor, fix errors and save the file. Rustlings will
automatically detect the file change and rerun the exercise. If all errors are
fixed, Rustlings will ask you to move on to the next exercise.
3. If you're stuck on an exercise, enter `h` (or `hint`) to show a hint.
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,
and sometimes, 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!
(https://github.com/rust-lang/rustlings). We look at every issue, and sometimes,
other learners do too so you can help each other out!
"""
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!
Before reporting an issue or contributing, please read our guidelines:
@ -41,9 +35,7 @@ name = "intro1"
dir = "00_intro"
test = false
# TODO: Fix hint
hint = """
Remove the `I AM NOT DONE` comment in the `exercises/intro00/intro1.rs` file
to move on to the next exercise."""
hint = """Enter `n` (or `next`) followed by ENTER to move on to the next exercise"""
[[exercises]]
name = "intro2"

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

@ -194,7 +194,7 @@ impl<'a> UiState<'a> {
let message = if self.message.is_empty() {
// Help footer.
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 {
self.message.as_str().light_blue()

@ -124,5 +124,5 @@ The automatic detection of exercise file changes failed :(
Please try running `rustlings` again.
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,
"{}\n",
"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()
.green(),
)?;

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

Loading…
Cancel
Save