genome-sh 0.1.0

The jq of genomics. Fast, local, human-readable variant analysis.
mod compact;
mod human;
mod json;

use anyhow::Result;

use crate::variant::AnnotatedVariant;

/// Output format selection.
#[derive(Clone, Debug, Default, clap::ValueEnum)]
pub enum Format {
    /// Human-readable terminal output with boxes and colors.
    #[default]
    Human,
    /// Structured JSON output for scripting.
    Json,
    /// Compact single-line output for pipelines.
    Compact,
}

/// Prints annotated variants in the selected format.
pub struct VariantPrinter {
    format: Format,
}

impl VariantPrinter {
    pub fn new(format: Format) -> Self {
        Self { format }
    }

    pub fn print(&self, variant: &AnnotatedVariant) -> Result<()> {
        match self.format {
            Format::Human => human::print(variant),
            Format::Json => json::print(variant),
            Format::Compact => compact::print(variant),
        }
    }
}