malwaredb 0.3.2

Service for storing malicious, benign, or unknown files and related metadata and relationships.
// SPDX-License-Identifier: Apache-2.0

use super::super::config::Config;
use malwaredb_server::vt::VtUpdater;

use std::process::ExitCode;

use anyhow::Result;
use clap::Parser;

#[derive(Parser, Debug)]
pub struct Updater {
    /// Configuration for Virus Total
    #[clap(subcommand)]
    cmd: Option<super::VtConfig>,
}

impl Updater {
    pub async fn execute(self) -> Result<ExitCode> {
        let cfg = match self.cmd {
            Some(config) => config.config()?,
            None => Config::from_found_files()?,
        };

        let updater: VtUpdater = cfg.into_state().await?.try_into()?;
        updater.updater().await
    }
}