1mod common;
16mod control;
17mod repair;
18mod snapshot;
19mod utils;
20
21use clap::Subcommand;
22use common_error::ext::BoxedError;
23
24use crate::metadata::control::{DelCommand, GetCommand};
25use crate::metadata::repair::RepairLogicalTablesCommand;
26use crate::metadata::snapshot::SnapshotCommand;
27use crate::Tool;
28
29#[derive(Subcommand)]
33pub enum MetadataCommand {
34 #[clap(subcommand)]
35 Snapshot(SnapshotCommand),
36 #[clap(subcommand)]
37 Get(GetCommand),
38 #[clap(subcommand)]
39 Del(DelCommand),
40 RepairLogicalTables(RepairLogicalTablesCommand),
41}
42
43impl MetadataCommand {
44 pub async fn build(&self) -> Result<Box<dyn Tool>, BoxedError> {
45 match self {
46 MetadataCommand::Snapshot(cmd) => cmd.build().await,
47 MetadataCommand::RepairLogicalTables(cmd) => cmd.build().await,
48 MetadataCommand::Get(cmd) => cmd.build().await,
49 MetadataCommand::Del(cmd) => cmd.build().await,
50 }
51 }
52}