use clap::Args;
use crate::application::fetch::{self, FetchOptions};
use crate::cli::error::CliError;
use crate::cli::output::fetch::print_fetch_report;
#[derive(Debug, Args)]
pub struct FetchArgs {
#[arg(short, long)]
year: Option<usize>,
#[arg(short, long)]
day: Option<usize>,
#[arg(long, conflicts_with = "day")]
all: bool,
}
pub(crate) fn execute(args: &FetchArgs) -> Result<bool, CliError> {
let reports = fetch::execute(&FetchOptions {
year: args.year,
day: args.day,
all: args.all,
})?;
print_fetch_report(&reports, args.all);
Ok(reports.iter().all(|report| report.outcome.is_ok()))
}