mirror of
https://github.com/notohh/rustlings.git
synced 2024-10-30 08:49:12 -04:00
Start a script to regenerate README.md from a template
So far this doesn't actually do any templating, just adds a note about the README being autogenerated :)
This commit is contained in:
parent
7c10d8315b
commit
87d8131f1f
6 changed files with 188 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
*.swp
|
||||
target/
|
||||
|
|
4
Cargo.lock
generated
Normal file
4
Cargo.lock
generated
Normal file
|
@ -0,0 +1,4 @@
|
|||
[root]
|
||||
name = "rustlings"
|
||||
version = "0.1.0"
|
||||
|
4
Cargo.toml
Normal file
4
Cargo.toml
Normal file
|
@ -0,0 +1,4 @@
|
|||
[package]
|
||||
name = "rustlings"
|
||||
version = "0.1.0"
|
||||
authors = ["Carol (Nichols || Goulding) <carol.nichols@gmail.com>"]
|
152
README-template.md
Normal file
152
README-template.md
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,7 @@
|
|||
<!-- This file was autogenerated by the script in src/bin/generate_readme.rs.
|
||||
Please edit either the script or the template in README-template.md in
|
||||
order to make changes here rather than committing the changes directly. -->
|
||||
|
||||
# rustlings
|
||||
|
||||
Small exercises to get you used to reading and writing Rust code. Includes practice reading and responding to
|
||||
|
|
23
src/bin/generate_readme.rs
Normal file
23
src/bin/generate_readme.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
// This script reads README-template.md and generates the playground links
|
||||
// from the Rust source files in the various directories.
|
||||
|
||||
// To add a new exercise, add it to the appropriate place in README-template.md
|
||||
// and then make sure to recompile this script (because the template gets
|
||||
// included at compile time and then run it to generate a new version of
|
||||
// README.md.
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
|
||||
fn main() {
|
||||
let template = include_str!("../../README-template.md");
|
||||
|
||||
let mut generated_readme = File::create("README.md").unwrap();
|
||||
write!(generated_readme, "\
|
||||
<!-- This file was autogenerated by the script in src/bin/generate_readme.rs.
|
||||
Please edit either the script or the template in README-template.md in
|
||||
order to make changes here rather than committing the changes directly. -->
|
||||
|
||||
").unwrap();
|
||||
write!(generated_readme, "{}", template).unwrap();
|
||||
}
|
Loading…
Reference in a new issue