zedazo-core 0.5.1

Núcleo de dominio y casos de uso de Zedazo (sin CLI/HTTP)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Caso de uso: Export — CSV o JSON a partir del pipeline cribar (dry-run).

use std::path::Path;

use crate::application::cribar;
use crate::error::CribaError;
use crate::infrastructure::csv_writer::export_csv;
use crate::infrastructure::json_writer::export_json;

/// Ejecuta cribado en dry-run y exporta contactos activos a CSV o JSON.
pub fn execute(input: &Path, output: &Path, format: &str) -> Result<(), CribaError> {
    let (_stats, contacts) = cribar::execute(input, None, None, None, "auto", true, false)?;
    match format {
        "json" => export_json(&contacts, output)?,
        _ => export_csv(&contacts, output)?,
    }
    Ok(())
}