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:
27
src/args.rs
27
src/args.rs
@@ -3,9 +3,7 @@ use std::str::FromStr;
|
||||
|
||||
use clap::*;
|
||||
|
||||
/**
|
||||
* Main struct for command-line arguments.
|
||||
*/
|
||||
/// Main struct for command-line arguments, parsed via Clap.
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub struct Args {
|
||||
@@ -22,9 +20,7 @@ pub struct Args {
|
||||
pub ids_or_tags: Vec<NumberOrString>,
|
||||
}
|
||||
|
||||
/**
|
||||
* Struct for mode-specific arguments.
|
||||
*/
|
||||
/// Struct for mode-specific arguments, defining CLI flags for different operations.
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
pub struct ModeArgs {
|
||||
#[arg(group("mode"), help_heading("Mode Options"), short, long, conflicts_with_all(["get", "diff", "list", "delete", "info", "status"]))]
|
||||
@@ -82,9 +78,7 @@ pub struct ModeArgs {
|
||||
pub server_port: Option<u16>,
|
||||
}
|
||||
|
||||
/**
|
||||
* Struct for item-specific arguments.
|
||||
*/
|
||||
/// Struct for item-specific arguments, such as compression and plugins.
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
pub struct ItemArgs {
|
||||
#[arg(help_heading("Item Options"), short, long, env("KEEP_COMPRESSION"))]
|
||||
@@ -101,9 +95,7 @@ pub struct ItemArgs {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Struct for general options.
|
||||
*/
|
||||
/// Struct for general options, including verbosity, paths, and output settings.
|
||||
#[derive(Parser, Debug, Default, Clone)]
|
||||
pub struct OptionsArgs {
|
||||
#[arg(long, env("KEEP_CONFIG"))]
|
||||
@@ -150,11 +142,7 @@ pub struct OptionsArgs {
|
||||
pub force: bool,
|
||||
}
|
||||
|
||||
use derive_more::From;
|
||||
|
||||
/**
|
||||
* Enum for representing either a number or a string.
|
||||
*/
|
||||
/// Enum for representing either a number (item ID) or a string (tag).
|
||||
#[derive(Debug, Clone, From)]
|
||||
pub enum NumberOrString {
|
||||
Number(i64),
|
||||
@@ -170,6 +158,11 @@ impl FromStr for NumberOrString {
|
||||
}
|
||||
}
|
||||
|
||||
/// Validates the parsed arguments based on mode constraints.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `Result<(), String>` - Ok if valid, or an error message string.
|
||||
impl Args {
|
||||
/// Validate the arguments based on the selected mode
|
||||
pub fn validate(&self) -> Result<(), String> {
|
||||
|
||||
Reference in New Issue
Block a user