Compare commits

...

6 commits

Author SHA1 Message Date
mo8it 7f73219041 chore: Release 2024-04-29 00:36:50 +02:00
mo8it 196d3c1a98 Bump version 2024-04-29 00:36:13 +02:00
mo8it 8c60ac267e Add working environment section 2024-04-29 00:26:53 +02:00
mo8it 3c7e7368b2 Add solutions to the initialized .gitignore 2024-04-28 23:25:44 +02:00
mo8it 593f0e0916 Revert escaping with ESC in list to be able to clear the message 2024-04-28 23:22:11 +02:00
mo8it 1508938fed Highlight the active filter 2024-04-28 23:21:13 +02:00
6 changed files with 45 additions and 15 deletions

8
Cargo.lock generated
View file

@ -303,9 +303,9 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.14.3" version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [ dependencies = [
"ahash", "ahash",
"allocator-api2", "allocator-api2",
@ -649,7 +649,7 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]] [[package]]
name = "rustlings" name = "rustlings"
version = "6.0.0-beta.5" version = "6.0.0-beta.6"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"assert_cmd", "assert_cmd",
@ -668,7 +668,7 @@ dependencies = [
[[package]] [[package]]
name = "rustlings-macros" name = "rustlings-macros"
version = "6.0.0-beta.5" version = "6.0.0-beta.6"
dependencies = [ dependencies = [
"quote", "quote",
"serde", "serde",

View file

@ -8,7 +8,7 @@ exclude = [
] ]
[workspace.package] [workspace.package]
version = "6.0.0-beta.5" version = "6.0.0-beta.6"
authors = [ authors = [
"Liv <mokou@fastmail.com>", "Liv <mokou@fastmail.com>",
"Mo Bitar <mo8it@proton.me>", "Mo Bitar <mo8it@proton.me>",
@ -50,11 +50,11 @@ include = [
anyhow = "1.0.82" anyhow = "1.0.82"
clap = { version = "4.5.4", features = ["derive"] } clap = { version = "4.5.4", features = ["derive"] }
crossterm = "0.27.0" crossterm = "0.27.0"
hashbrown = "0.14.3" hashbrown = "0.14.5"
notify-debouncer-mini = { version = "0.4.1", default-features = false } notify-debouncer-mini = { version = "0.4.1", default-features = false }
os_pipe = "1.1.5" os_pipe = "1.1.5"
ratatui = { version = "0.26.2", default-features = false, features = ["crossterm"] } ratatui = { version = "0.26.2", default-features = false, features = ["crossterm"] }
rustlings-macros = { path = "rustlings-macros", version = "=6.0.0-beta.5" } rustlings-macros = { path = "rustlings-macros", version = "=6.0.0-beta.6" }
serde_json = "1.0.116" serde_json = "1.0.116"
serde.workspace = true serde.workspace = true
toml_edit.workspace = true toml_edit.workspace = true

View file

@ -35,7 +35,7 @@ The following command will download and compile Rustlings:
<!-- TODO: Remove @6.0.0-beta.x --> <!-- TODO: Remove @6.0.0-beta.x -->
```bash ```bash
cargo install rustlings@6.0.0-beta.5 cargo install rustlings@6.0.0-beta.6
``` ```
<details> <details>
@ -44,7 +44,7 @@ cargo install rustlings@6.0.0-beta.5
<!-- TODO: Remove @6.0.0-beta.x --> <!-- TODO: Remove @6.0.0-beta.x -->
- Make sure you have the latest Rust version by running `rustup update` - Make sure you have the latest Rust version by running `rustup update`
- Try adding the `--locked` flag: `cargo install rustlings@6.0.0-beta.5 --locked` - Try adding the `--locked` flag: `cargo install rustlings@6.0.0-beta.6 --locked`
- Otherwise, please [report the issue](https://github.com/rust-lang/rustlings/issues/new) - Otherwise, please [report the issue](https://github.com/rust-lang/rustlings/issues/new)
</details> </details>
@ -64,6 +64,21 @@ cd rustlings/
rustlings rustlings
``` ```
## Working environment
### Editor
Our general recommendation is [VS Code](https://code.visualstudio.com/) with the [rust-analyzer plugin](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).
But any editor that supports [rust-analyzer](https://rust-analyzer.github.io/) should be enough for working on the exercises.
### Terminal
While working with Rustlings, please use a modern terminal for the best user experience.
The default terminal on Linux and Mac should be sufficient.
On Windows, we recommend the [Windows Terminal](https://aka.ms/terminal).
If you use VS Code, the builtin terminal should also be fine.
## Doing exercises ## Doing exercises
The exercises are sorted by topic and can be found in the subdirectory `exercises/<topic>`. The exercises are sorted by topic and can be found in the subdirectory `exercises/<topic>`.

View file

@ -69,6 +69,7 @@ pub fn init() -> Result<()> {
} }
const GITIGNORE: &[u8] = b".rustlings-state.txt const GITIGNORE: &[u8] = b".rustlings-state.txt
solutions
Cargo.lock Cargo.lock
target target
.vscode .vscode

View file

@ -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::Esc | KeyCode::Char('q') => break, 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(),

View file

@ -2,7 +2,7 @@ use anyhow::{Context, Result};
use ratatui::{ use ratatui::{
layout::{Constraint, Rect}, layout::{Constraint, Rect},
style::{Style, Stylize}, style::{Style, Stylize},
text::Span, text::{Line, Span},
widgets::{Block, Borders, HighlightSpacing, Paragraph, Row, Table, TableState}, widgets::{Block, Borders, HighlightSpacing, Paragraph, Row, Table, TableState},
Frame, Frame,
}; };
@ -193,11 +193,25 @@ impl<'a> UiState<'a> {
let message = if self.message.is_empty() { let message = if self.message.is_empty() {
// Help footer. // Help footer.
Span::raw( let mut spans = Vec::with_capacity(4);
"↓/j ↑/k home/g end/G │ <c>ontinue at │ <r>eset │ filter <d>one/<p>ending │ <q>uit", spans.push(Span::raw(
) "↓/j ↑/k home/g end/G │ <c>ontinue at │ <r>eset │ filter ",
));
match self.filter {
Filter::Done => {
spans.push("<d>one".underlined().magenta());
spans.push(Span::raw("/<p>ending"));
}
Filter::Pending => {
spans.push(Span::raw("<d>one/"));
spans.push("<p>ending".underlined().magenta());
}
Filter::None => spans.push(Span::raw("<d>one/<p>ending")),
}
spans.push(Span::raw(" │ <q>uit"));
Line::from(spans)
} else { } else {
self.message.as_str().light_blue() Line::from(self.message.as_str().light_blue())
}; };
frame.render_widget( frame.render_widget(
message, message,