+use std::fs;
+use std::path::PathBuf;
+use crate::configuration::Configuration;
+
+pub fn status() -> String {
+ let configuration = Configuration::new();
+ let mut status_message = String::new();
+
+ status_message.push_str("# Configuration\n");
+ status_message.push_str("## Directories\n");
+
+ // Main Configuration Locations
+ status_message.push_str(&get_directory_stats("Configuration", configuration.config_directory));
+ status_message.push_str(&get_directory_stats("Data", configuration.data_directory));
+ status_message.push_str(&get_directory_stats("Output", configuration.output_directory));
+
+ status_message.push_str("## Blog Settings\n");
+ status_message.push_str(&format!("Number of posts to keep: {}\n", configuration.max_posts));
+ status_message
+}
+
+fn get_directory_stats(label: &str, directory: PathBuf) -> String {
+ let mut status_message = String::new();
+
+ status_message.push_str(&format!("{}: {}\n", label, directory.display()));
+ if directory.exists() {
+ status_message.push_str(&format!("{} directory exists.\n", label));
+ if fs::read_dir(&directory).is_ok() {
+ status_message.push_str(&format!("{} directory is readable.\n", label));
+ } else {
+ status_message.push_str(&format!("{} directory is not readable.\n", label));
+ }
+ } else {
+ status_message.push_str(&format!("{} directory does not exist.\n", label));
+ }
+
+ status_message
+}