use clap::Subcommand;
use lib::Error;
use crate::log::init_logging_stderr;
use super::{
Command, CreateFilterCommand, ImportFilterCommand, config_command::ConfigCommand,
configure::ConfigureCommand,
};
#[derive(Subcommand, Debug)]
pub enum UtilityCommands {
#[clap(aliases = ["register-filter"])]
ImportFilter(ImportFilterCommand),
#[clap(alias = "new-filter")]
CreateFilter(CreateFilterCommand),
Configure(ConfigureCommand),
Config(ConfigCommand),
}
impl Command for UtilityCommands {
async fn execute(&self) -> Result<(), Error> {
let _ = init_logging_stderr(false);
match self {
Self::ImportFilter(command) => command.execute().await,
Self::CreateFilter(command) => command.execute().await,
Self::Configure(command) => command.execute().await,
Self::Config(command) => command.execute().await,
}
}
}