use crate::storage::{Post, create_it, write_it};
use std::error::Error;
pub fn execute(
savethis: &str,
posts: &mut Vec<Post>,
filename: &str,
) -> Result<(), Box<dyn Error>> {
let mut buffer = String::new();
eprintln!("Type description to the command (or just hit Enter)");
std::io::stdin().read_line(&mut buffer)?;
eprintln!("command :{savethis}, comment :{buffer}");
buffer = buffer.trim().to_string();
create_it(savethis.to_string(), buffer, posts)?;
write_it(filename, posts)?;
Ok(())
}