fancy caching works now

This commit is contained in:
2025-06-25 19:57:28 +02:00
parent 784dcbf91c
commit e4c6a7e0a8
5 changed files with 226 additions and 36 deletions

View File

@@ -2,6 +2,7 @@ use clap::{Parser, Subcommand};
mod markdown;
use markdown::{get_all_posts, get_post_by_slug, get_posts_by_tag, watch_posts};
use serde_json;
use std::fs;
#[derive(Parser)]
#[command(name = "Markdown Backend")]
@@ -30,6 +31,7 @@ enum Commands {
}
fn main() {
markdown::load_post_cache_from_disk();
let cli = Cli::parse();
match &cli.command {
Commands::List => {
@@ -43,6 +45,7 @@ fn main() {
match get_post_by_slug(slug) {
Ok(post) => {
println!("{}", serde_json::to_string(&post).unwrap());
markdown::save_post_cache_to_disk();
}
Err(e) => {
eprintln!("{}", e);