Skip to main content

omni_dev/cli/git/
amend.rs

1//! Amend command — applies commit message amendments from a YAML file.
2
3use anyhow::{Context, Result};
4use clap::Parser;
5
6/// Amend command options.
7#[derive(Parser)]
8pub struct AmendCommand {
9    /// YAML file containing commit amendments.
10    #[arg(value_name = "YAML_FILE")]
11    pub yaml_file: String,
12}
13
14impl AmendCommand {
15    /// Executes the amend command.
16    pub fn execute(self) -> Result<()> {
17        use crate::git::AmendmentHandler;
18
19        println!("🔄 Starting commit amendment process...");
20        println!("📄 Loading amendments from: {}", self.yaml_file);
21
22        // Create amendment handler and apply amendments
23        let handler = AmendmentHandler::new().context("Failed to initialize amendment handler")?;
24
25        handler
26            .apply_amendments(&self.yaml_file)
27            .context("Failed to apply amendments")?;
28
29        Ok(())
30    }
31}