feat: Show a completion message when watching
The completion message is shown only once all exercises succeed and are
not annotated with "I AM NOT DONE." The watch command will also exit
closes#251
Let me know if there are any tests I could add or if the completion message should be tweaked!
The completion message is shown only once all exercises succeed and are
not annotated with "I AM NOT DONE." The watch command will also exit
closes#251
feat: Add type conversion and parsing exercises
This pull request adds exercises for converting values into specific types. The exercises uses string to struct type conversions, but most of the traits in the exercises can handle more than just string parsing and conversions.
The following traits are covered:
1. `From` and `Into`
2. `TryFrom` and `TryInto`
3. `AsRef`
4. `FromStr`
The `as` operator is also covered.
After being stuck on exercise enums3.rs for about an hour or two, having read the entire chapter on enums 2-3 times, and still being unable to complete the exercise, i started broadening my reading. I finally found the answer in the rust docs via google.
feat(watch): show hint while watching
`rustlings hint ...` command is not convenient when doing exercises with `rustlings watch`.
This PR makes it possible for user to type `hint` while running `watch` and get hint text for exercise which is currently failing.
e.g.
```rust
...
--> exercises/variables/variables1.rs:13:36
|
13 | println!("x has the value {}", x);
| ^ not found in this scope
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
type 'hint' to get help:
hint
Hint: The declaration on line 12 is missing a keyword that is needed in Rust
to create a new variable binding.
```
Update line numbers in hints and outdated comment
In functions4, the missing code is in line 14 in the latest version:
```rust
error: expected type, found `{`
--> exercises/functions/functions4.rs:14:30
|
14 | fn sale_price(price: i32) -> {
| ^ expected type
error: aborting due to previous error
```
but the hint points to line 12. This is due to a recent change in 2cdd61294f.
Also includes similar updates for strings2 and primitive_types4.
fix(run): makes `run` never prompt
`watch` and `verify` do prompt the user to actively move to the
next exercise. This change fixes `run` to never prompt. Previously
it was inconsistent between "test" and "compile" exercises.
BREAKING CHANGE: we again change the behavior of the `run` command
`watch` and `verify` do prompt the user to actively move to the
next exercise. This change fixes `run` to never prompt. Previously
it was inconsistent between "test" and "compile" exercises.
BREAKING CHANGE: we again change the behavior of the `run` command
feat(cli): check for rustc before doing anything
Addresses #190. From the backtraces shown there, it seems like we're not able to launch `rustc` (which is odd, given that they probably compiled and installed `rustlings` 🤷♀️)
Refactor hints
Breaking change. This removes hints from the end of files, and puts them into `info.toml`. You can now access hints using:
```
rustlings hint <exerciseName>
```
ALSO this changes the exercise system to index by name for `run` and `hint`, so:
```
rustlings run exercises/if/if1.rs
```
becomes
```
rustlings run if1
```