Skip to content

Commit 1b4e590

Browse files
senekormo8it
authored andcommitted
Add readme to generated rustlings directory
This can remind users how to use rustlings, in case they come back after a lengthy break.
1 parent 30edc55 commit 1b4e590

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/init.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ pub fn init() -> Result<()> {
165165
fs::write(".gitignore", GITIGNORE)
166166
.context("Failed to create the file `rustlings/.gitignore`")?;
167167

168+
fs::write("README.md", README).context("Failed to create the file `rustlings/README.md`")?;
169+
168170
create_dir(".vscode").context("Failed to create the directory `rustlings/.vscode`")?;
169171
fs::write(".vscode/extensions.json", VS_CODE_EXTENSIONS_JSON)
170172
.context("Failed to create the file `rustlings/.vscode/extensions.json`")?;
@@ -220,6 +222,14 @@ target/
220222
.vscode/
221223
";
222224

225+
const README: &[u8] = b"# Rustlings
226+
227+
This is your space to solve Rustlings exercises.
228+
Simply run `rustlings` in this directory to get started!
229+
Learn more about using Rustlings here:
230+
<https://rustlings.rust-lang.org/usage/>
231+
";
232+
223233
pub const VS_CODE_EXTENSIONS_JSON: &[u8] = br#"{"recommendations":["rust-lang.rust-analyzer"]}"#;
224234

225235
const IN_INITIALIZED_DIR_ERR: &str = "It looks like Rustlings is already initialized in this directory.

0 commit comments

Comments
 (0)