use std::process::ExitCode;

use anyhow::Result;

use crate::commands;
use crate::output::{self, OutputFormat};

pub(crate) fn dispatch(command: crate::MigrateCommand, format: OutputFormat) -> Result<ExitCode> {
    match command {
        crate::MigrateCommand::FromPodLayout(args) => {
            let report = commands::migrate::from_pod_layout(args.path.as_deref(), args.dry_run)?;
            output::render_report(format, &report)
        }
    }
}
