-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rs
36 lines (31 loc) · 922 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::blogger::Blogger;
use std::path::PathBuf;
use structopt::StructOpt;
mod blogger;
mod post;
#[derive(Debug, StructOpt)]
struct Cli {
#[structopt(default_value = "./posts")]
posts_dir: String,
#[structopt(default_value = "./static")]
static_files_dir: String,
#[structopt(default_value = "./templates")]
templates_dir: String,
#[structopt(default_value = "./build")]
build_dir: String,
#[structopt(default_value = "about")]
excludes: Vec<String>,
}
fn main() {
let args = Cli::from_args();
let blog = Blogger::new(&args.build_dir, &args.posts_dir, &args.templates_dir);
blog.render_posts(&args.excludes)
.expect("render all posts failed!");
for it in args.excludes {
blog.render(it.as_str()).unwrap();
}
Blogger::copy_static_files(
PathBuf::from(&args.static_files_dir),
PathBuf::from(&args.build_dir),
);
}