|
@@ -118,7 +118,26 @@ fn build() {
|
118
|
118
|
render_post_listing(&cwd, &layout_template, &post_item_template, &posts);
|
119
|
119
|
}
|
120
|
120
|
|
121
|
|
-fn new(name: &str) {}
|
|
121
|
+fn new(name: &str) {
|
|
122
|
+ let cwd = env::current_dir().expect("Couldn't read current directory");
|
|
123
|
+ let project_path = cwd.join(name);
|
|
124
|
+ fs::create_dir(&project_path).expect(&format!("Couldn't create directory '{}'", &name));
|
|
125
|
+ fs::create_dir(&project_path.join("posts")).expect("Couldn't create posts directory");
|
|
126
|
+ fs::create_dir(&project_path.join("public")).expect("Couldn't create public directory");
|
|
127
|
+ fs::create_dir(&project_path.join("templates")).expect("Couldn't create templates directory");
|
|
128
|
+ fs::write(&project_path.join("templates").join("layout.html"), "")
|
|
129
|
+ .expect("Couldn't write templates/layout.html");
|
|
130
|
+ fs::write(&project_path.join("templates").join("index.html"), "")
|
|
131
|
+ .expect("Couldn't write templates/index.html");
|
|
132
|
+ fs::write(&project_path.join("templates").join("post.html"), "")
|
|
133
|
+ .expect("Couldn't write templates/post.html");
|
|
134
|
+ fs::write(
|
|
135
|
+ &project_path
|
|
136
|
+ .join("templates")
|
|
137
|
+ .join("post_listing_item.html"),
|
|
138
|
+ "",
|
|
139
|
+ ).expect("Couldn't write templates/post_listing_item.html");
|
|
140
|
+}
|
122
|
141
|
|
123
|
142
|
fn main() {
|
124
|
143
|
let matches = App::new("tlon")
|