feat(blog::components::check_update) impl consistency_guard, fix handle_create issues

This commit is contained in:
lumither committed 2025-04-17 23:40:30 -07:00
1 parent 71af26a09c
commit e83cea1d42
18 files changed
+392 -85

No files matched your search

@@ -7,7 +7,9 @@ use crate::constants::{
use chrono::NaiveDate;
use dirs::home_dir;
use markdown::MdFile;
use tracing::warn;
use uuid::Uuid;
pub fn expand_path(path: String) -> String {
if path.starts_with('~') {
@@ -31,6 +33,13 @@ pub fn expand_path(path: String) -> String {
}
}
pub fn extract_post_id(post: &MdFile) -> Option<Uuid> {
match post.meta["id"].as_str() {
Some(id) => Uuid::parse_str(id).ok(),
None => None,
}
}
pub fn parse_post_identifier(path: &Path) -> Option<String> {
if let Some(comp) = path.components().nth_back(1) {
comp.as_os_str().to_str().map(|s| s.to_string())