docs: Add Rustdoc for modules, functions, and structs

Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-09-10 12:28:47 -03:00
parent 56a0ba2519
commit 58b5c8187b
8 changed files with 69 additions and 17 deletions

View File

@@ -8,6 +8,21 @@ use clap::Command;
use log::warn;
use rusqlite::Connection;
/// Handles the delete mode: removes items by ID from the database and storage.
///
/// # Arguments
///
/// * `_cmd` - Clap command for error handling (unused).
/// * `_settings` - Global settings (unused).
/// * `_config` - Configuration settings (unused).
/// * `ids` - List of item IDs to delete.
/// * `_tags` - Tags (unused, as delete only supports IDs).
/// * `conn` - Database connection.
/// * `data_path` - Path to data directory for storage cleanup.
///
/// # Returns
///
/// `Result<()>` on success, or an error if deletion fails.
pub fn mode_delete(
_cmd: &mut Command,
_settings: &config::Settings,

View File

@@ -11,6 +11,21 @@ use is_terminal::IsTerminal;
use std::path::PathBuf;
use std::io::Read;
/// Handles the get mode: retrieves and streams item content to stdout, applying filters if specified.
///
/// # Arguments
///
/// * `cmd` - Clap command for error handling.
/// * `settings` - Global settings, including force output flag.
/// * `ids` - List of item IDs (at most one).
/// * `tags` - List of tags to match (mutually exclusive with IDs).
/// * `conn` - Database connection.
/// * `data_path` - Path to data directory.
/// * `filter_chain` - Optional pre-parsed filter chain to apply to content.
///
/// # Returns
///
/// `Result<()>` on success, or an error if item not found or output fails.
pub fn mode_get(
cmd: &mut Command,
settings: &config::Settings,

View File

@@ -1,6 +1,9 @@
#[cfg(feature = "server")]
pub mod server;
/// Common utilities for all modes, including column types and output formatting.
pub mod common;
pub mod delete;
pub mod diff;
pub mod generate_config;
@@ -11,15 +14,36 @@ pub mod save;
pub mod status;
pub mod status_plugins;
/// Column types, output formats, and formatting utilities shared across modes.
pub use common::{ColumnType, OutputFormat, format_size, settings_output_format};
/// Deletes items from the database by ID.
pub use delete::mode_delete;
/// Compares two items and shows differences.
pub use diff::mode_diff;
/// Generates a default configuration file.
pub use generate_config::mode_generate_config;
/// Retrieves and outputs item content.
pub use get::mode_get;
/// Displays detailed information about items.
pub use info::mode_info;
/// Lists items with optional filtering.
pub use list::mode_list;
/// Saves new item content with optional tags and metadata.
pub use save::mode_save;
#[cfg(feature = "server")]
/// Starts the HTTP server for REST API access.
pub use server::mode_server;
/// Shows status of directories and compression support.
pub use status::mode_status;
/// Lists available plugins and their configurations.
pub use status_plugins::mode_status_plugins;