use std::path::PathBuf;
pub mod backend;
pub mod cli;
pub mod config;
pub mod database;
pub mod error;
pub mod history;
pub mod history_db;
pub mod prelude;
pub mod redaction;
pub mod search;
pub mod tui;
pub mod types;
pub use config::Config;
pub use error::{Error, Result};
pub use history::HistoryManager;
pub use redaction::RedactionEngine;
pub use search::SearchEngine;
pub use types::{CommandId, HostId, SessionId};
pub const DEFAULT_HISTORY_FILE: &str = "zam.log";
pub fn default_history_path() -> Result<PathBuf> {
let home = dirs::home_dir().ok_or(Error::HomeDirectoryNotFound)?;
Ok(home.join(".local").join("zam").join(DEFAULT_HISTORY_FILE))
}
pub fn init() -> Result<HistoryManager> {
let config = Config::default();
HistoryManager::new(config)
}
pub fn init_with_config(config: Config) -> Result<HistoryManager> {
HistoryManager::new(config)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_default_history_path() {
let path = default_history_path().unwrap();
assert!(path.ends_with(DEFAULT_HISTORY_FILE));
}
#[test]
fn test_init() {
let manager = init();
assert!(manager.is_ok());
}
}