]> git.huck.website - metaforge.git/commitdiff
clean flag
authorHuck Boles <huck@huck.website>
Thu, 11 May 2023 19:27:00 +0000 (14:27 -0500)
committerHuck Boles <huck@huck.website>
Thu, 11 May 2023 19:27:00 +0000 (14:27 -0500)
files/site/build/expand.html [deleted file]
files/site/build/expand_html.html [deleted file]
files/site/build/sub_dir/deep/deep.html [deleted file]
files/site/build/sub_dir/sub_dir.html [deleted file]
src/main.rs

diff --git a/files/site/build/expand.html b/files/site/build/expand.html
deleted file mode 100644 (file)
index a9c1572..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<body>
-
-
-</body>
diff --git a/files/site/build/expand_html.html b/files/site/build/expand_html.html
deleted file mode 100644 (file)
index 0a9c518..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<body>
-<h2 id="this-is-a-test">This is a test</h2>
-<p>
-Inline html
-</p>
-variable: GOOD pattern:
-<p>
-GOOD
-</p>
-<p>
-GOOD GOOD
-</p>
-
-</body>
diff --git a/files/site/build/sub_dir/deep/deep.html b/files/site/build/sub_dir/deep/deep.html
deleted file mode 100644 (file)
index a9c1572..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<body>
-
-
-</body>
diff --git a/files/site/build/sub_dir/sub_dir.html b/files/site/build/sub_dir/sub_dir.html
deleted file mode 100644 (file)
index d008ed6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<body>
-<p>This is a simple filler file with a single variable: variable</p>
-
-</body>
index c156dca890fb9022a2398e7f8d3f72ca059349d9..08a863b04328b042c792f80c81a432d5998fc7ee 100644 (file)
@@ -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)
 }