From: Huck Boles Date: Thu, 11 May 2023 19:27:00 +0000 (-0500) Subject: clean flag X-Git-Url: https://git.huck.website/?a=commitdiff_plain;h=4d97b9d30c24059053de1e82aaa868ee2e02a1dd;p=metaforge.git clean flag --- diff --git a/files/site/build/expand.html b/files/site/build/expand.html deleted file mode 100644 index a9c1572..0000000 --- a/files/site/build/expand.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/files/site/build/expand_html.html b/files/site/build/expand_html.html deleted file mode 100644 index 0a9c518..0000000 --- a/files/site/build/expand_html.html +++ /dev/null @@ -1,14 +0,0 @@ - -

This is a test

-

-Inline html -

-variable: GOOD pattern: -

-GOOD -

-

-GOOD GOOD -

- - diff --git a/files/site/build/sub_dir/deep/deep.html b/files/site/build/sub_dir/deep/deep.html deleted file mode 100644 index a9c1572..0000000 --- a/files/site/build/sub_dir/deep/deep.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/files/site/build/sub_dir/sub_dir.html b/files/site/build/sub_dir/sub_dir.html deleted file mode 100644 index d008ed6..0000000 --- a/files/site/build/sub_dir/sub_dir.html +++ /dev/null @@ -1,4 +0,0 @@ - -

This is a simple filler file with a single variable: variable

- - diff --git a/src/main.rs b/src/main.rs index c156dca..08a863b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,23 @@ use color_eyre::Result; -use metaforge::{build_site, parse_opts}; +use metaforge::{build_site, log, parse_opts}; fn main() -> Result<()> { color_eyre::install()?; let opts = parse_opts()?; + log!( + opts, + format!("cleaning build directory: {}", opts.build.display()), + 1 + ); + if opts.clean && opts.build.exists() { + std::fs::remove_dir_all(&opts.build)?; + } + + if !opts.build.exists() { + std::fs::create_dir(&opts.build)?; + } + build_site(&opts) }