summaryrefslogtreecommitdiff
path: root/src/bin/generate_readme.rs
diff options
context:
space:
mode:
authorCarol (Nichols || Goulding) <carol.nichols@gmail.com>2018-03-04 12:41:55 -0500
committerCarol (Nichols || Goulding) <carol.nichols@gmail.com>2018-03-04 12:41:55 -0500
commit87d8131f1f004a68adcdba74ef8b94290739e90b (patch)
tree76e9ef3ce2015bbedeafd1214da85437db17ee0d /src/bin/generate_readme.rs
parent7c10d8315b8f7de3267f157bd4392d50ec41a99f (diff)
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 :)
Diffstat (limited to 'src/bin/generate_readme.rs')
-rw-r--r--src/bin/generate_readme.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/bin/generate_readme.rs b/src/bin/generate_readme.rs
new file mode 100644
index 0000000..28b6cbd
--- /dev/null
+++ b/src/bin/generate_readme.rs
@@ -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();
+}