+use std::fs::read_dir;
+use std::path::PathBuf;
+use crate::configuration::Configuration;
+
+pub fn status(configuration: &Configuration) -> String {
+ let mut status_message = String::new();
+
+ status_message.push_str("# Blog\n");
+
+ // Main Configuration Locations
+ let blog_count = count_entries(&configuration.posts_directory);
+ status_message.push_str(&format!("Number of posts in blog: {}\n", blog_count));
+
+ let archive_count = count_entries(&configuration.archive_directory);
+ status_message.push_str(&format!("Number of posts in archive: {}\n", archive_count));
+ status_message
+}
+
+fn count_entries(path: &PathBuf) -> String {
+ match read_dir(path) {
+ Ok(entries) => entries.filter_map(Result::ok).count().to_string(),
+ Err(_) => "0".to_string()
+ }
+}