docs: Add comprehensive documentation for modes, services, and plugins

Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-09-10 14:29:16 -03:00
parent d44f3fbb5b
commit 88c7290a7b
6 changed files with 146 additions and 12 deletions

View File

@@ -11,6 +11,22 @@ use crate::services::item_service::ItemService;
use chrono::prelude::*;
use comfy_table::{Cell, Attribute};
/// Displays detailed information about an item or the last item if no ID/tags specified.
///
/// Supports table, JSON, or YAML output formats.
///
/// # Arguments
///
/// * `cmd` - Mutable Clap command for error handling.
/// * `settings` - Application settings.
/// * `ids` - Mutable vector of item IDs (at most one).
/// * `tags` - Mutable vector of tags (mutually exclusive with IDs).
/// * `conn` - Mutable database connection.
/// * `data_path` - Path to data directory.
///
/// # Returns
///
/// `Ok(())` on success, or Result with error.
pub fn mode_info(
cmd: &mut Command,
settings: &config::Settings,
@@ -37,7 +53,8 @@ pub fn mode_info(
}
#[derive(Debug, Serialize, Deserialize)]
struct ItemInfo {
/// Structured representation of item information for JSON/YAML output.
pub struct ItemInfo {
id: i64,
timestamp: String,
path: String,
@@ -55,6 +72,17 @@ fn show_item(
settings: &config::Settings,
data_path: PathBuf,
) -> Result<()> {
/// Displays item information in table format or delegates to structured output.
///
/// # Arguments
///
/// * `item_with_meta` - Item with associated metadata and tags.
/// * `settings` - Application settings for formatting.
/// * `data_path` - Path to data directory for file size calculation.
///
/// # Returns
///
/// `Ok(())` on success.
let output_format = crate::modes::common::settings_output_format(settings);
if output_format != OutputFormat::Table {
@@ -135,6 +163,18 @@ fn show_item_structured(
data_path: PathBuf,
output_format: OutputFormat,
) -> Result<()> {
/// Displays item information in structured JSON or YAML format.
///
/// # Arguments
///
/// * `item_with_meta` - Item with metadata and tags.
/// * `settings` - Settings for size formatting.
/// * `data_path` - Data path for file size.
/// * `output_format` - JSON or YAML.
///
/// # Returns
///
/// `Ok(())` on success.
let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
let meta_map = item_with_meta.meta_as_map();
let item = item_with_meta.item;