rusty_commit_saver/lib.rs
1#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
2//! # Rusty Commit Saver
3//!
4//! A Rust tool to automatically log Git commits into Obsidian diary entries.
5//!
6//! ## Overview
7//!
8//! Rusty Commit Saver captures each commit's metadata and appends it to a dated
9//! diary entry in your Obsidian vault. Each entry includes:
10//!
11//! - Timestamp
12//! - Commit message
13//! - Repository URL
14//! - Branch name
15//! - Commit hash
16//!
17//! ## Quick Start
18//!
19//! ```ignore
20//! use rusty_commit_saver::{run_commit_saver, config::GlobalVars};
21//! use std::path::PathBuf;
22//!
23//! // Initialize configuration
24//! let global_vars = GlobalVars::new();
25//! global_vars.set_all();
26//!
27//! // Get configuration values
28//! let obsidian_root = global_vars.get_obsidian_root_path_dir();
29//! let commit_path = global_vars.get_obsidian_commit_path();
30//! let date_template = global_vars.get_template_commit_date_path();
31//!
32//! // Save the commit
33//! run_commit_saver(obsidian_root, &commit_path, &date_template).unwrap();
34//! ```
35//!
36//! ## Configuration
37//!
38//! Configuration is stored in an INI file at:
39//! `~/.config/rusty-commit-saver/rusty-commit-saver.ini`
40//!
41//! Example configuration:
42//!
43//! ```text
44//! [obsidian]
45//! root_path_dir = ~/Documents/Obsidian
46//! commit_path = Diaries/Commits
47//!
48//! [templates]
49//! commit_date_path = %Y/%m-%B/%F.md
50//! commit_datetime = %Y-%m-%d %H:%M:%S
51//! ```
52//!
53//! ## Modules
54//!
55//! - [`vim_commit`] - Core commit processing and diary file operations
56//! - [`config`] - Configuration management and INI file parsing
57//!
58//! ## Features
59//!
60//! - ✅ Automatic diary entry creation with YAML frontmatter
61//! - ✅ Timestamped commit rows formatted for Obsidian
62//! - ✅ Customizable storage path with date-based organization
63//! - ✅ Pipe escaping in commit messages for Markdown table safety
64//! - ✅ Thread-safe configuration with `OnceCell`
65pub mod config;
66pub mod vim_commit;