Implement the shared automation CLI.

This commit is contained in:
2026-07-19 14:25:15 +02:00
parent a2abb901cd
commit fdfae200a0
33 changed files with 2411 additions and 58 deletions

View File

@@ -0,0 +1,34 @@
use std::path::PathBuf;
/// Machine-local application data directory shared by every RuDS surface.
pub fn application_data_dir() -> PathBuf {
dirs::data_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join("bds")
}
/// SQLite cache/registry used by desktop, CLI, TUI, and remote surfaces.
pub fn application_database_path() -> PathBuf {
application_data_dir().join("bds.db")
}
/// Default portable project folder used on first launch.
pub fn default_project_data_dir() -> PathBuf {
dirs::home_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join("bds")
.join("my-blog")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn database_is_inside_application_data_directory() {
assert_eq!(
application_database_path(),
application_data_dir().join("bds.db")
);
}
}

View File

@@ -1,3 +1,4 @@
pub mod app_paths;
pub mod atomic_write;
mod checksum;
pub mod frontmatter;
@@ -7,6 +8,7 @@ mod slug;
pub mod thumbnail;
pub mod timestamp;
pub use app_paths::{application_data_dir, application_database_path, default_project_data_dir};
pub use atomic_write::{atomic_write, atomic_write_str};
pub use checksum::{content_hash, file_hash};
pub use paths::*;