use super::{FightOutcome, LogResult, Opt};

use std::io;

pub mod aggregators;
pub mod formats;
pub mod pipeline;

pub use self::pipeline::Pipeline;

use self::formats::Format;

/// Build an pipeline for the given command line options.
pub fn build_pipeline(opt: &Opt) -> Pipeline {
    let stream = io::stdout();
    let aggregator = aggregators::WriteThrough;

    let format: Box<dyn Format> = if opt.file_name_only {
        Box::new(formats::FileOnly)
    } else {
        Box::new(formats::HumanReadable {
            show_guilds: opt.guilds,
        })
    };

    Pipeline::new(Box::new(stream), format, Box::new(aggregator))
}