diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-03-08 23:38:23 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-03-08 23:38:23 +0100 |
| commit | 6352ebb0eb4cb83240c6d4998e0ef1375b041191 (patch) | |
| tree | 3ade08c77c8ab403d3196f80fad5ed3034c3035b /src/command/generate.rs | |
| parent | 60307a9a3a39dccf652c9d9b4348e44db1e67627 (diff) | |
Generate and archive blog, allow publishing
Diffstat (limited to 'src/command/generate.rs')
| -rw-r--r-- | src/command/generate.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/command/generate.rs b/src/command/generate.rs index c8c5673..cc9e401 100644 --- a/src/command/generate.rs +++ b/src/command/generate.rs @@ -5,6 +5,7 @@ use crate::configuration::Configuration; use crate::constants::METADATA_FILENAME; use crate::gemini_parser::parse; use crate::generator::generate; +use crate::archiver::archive; use crate::metadata::Metadata; use crate::post::Post; @@ -18,7 +19,7 @@ impl Generate { fn read_posts(&self, posts_directory: &PathBuf, max_posts: u8) -> Vec<Post> { let mut posts = Vec::new(); - for i in 0..max_posts - 1 { + for i in 0..max_posts { let post_directory = posts_directory.join(i.to_string()); match self.read_post(&post_directory, i) { Some(post) => posts.push(post), @@ -82,6 +83,11 @@ impl super::Command for Generate { let _ = remove_dir_all(&configuration.archive_output_directory); create_dir_all(&configuration.archive_output_directory)?; + archive( + &configuration.archive_directory, + &configuration.templates_directory, + &configuration.archive_output_directory + )?; return Ok(()) } |