use std::process::ExitCode;

use anyhow::Result;

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

pub(crate) fn dispatch(command: crate::PodCommand, format: OutputFormat) -> Result<ExitCode> {
    match command {
        crate::PodCommand::Init(_) => {
            let report = commands::pod::init_shim();
            output::render_report(format, &report)
        }
        crate::PodCommand::List => {
            let report = commands::pod::list_shim();
            output::render_report(format, &report)
        }
        crate::PodCommand::Status(_) => {
            let report = commands::pod::status_shim();
            output::render_report(format, &report)
        }
        crate::PodCommand::MigrateDefaults(_) => {
            let report = commands::pod::migrate_defaults_shim();
            output::render_report(format, &report)
        }
    }
}
