filelift 0.1.0

A small CLI for lifting local files to S3-compatible object storage.
use anyhow::Result;

use crate::{
    cli::{LogCommands, LogExportCommand},
    diagnostic_log,
};

pub fn run(command: LogCommands) -> Result<()> {
    match command {
        LogCommands::Export(command) => export(command),
        LogCommands::Clear => clear(),
    }
}

fn export(command: LogExportCommand) -> Result<()> {
    let count = diagnostic_log::export_to(command.output.as_std_path())?;
    println!(
        "Exported diagnostic log to {} ({count} events). Review it before sharing.",
        command.output
    );
    Ok(())
}

fn clear() -> Result<()> {
    diagnostic_log::clear()?;
    println!("Cleared diagnostic logs.");
    Ok(())
}