1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
mod command;
mod export;
mod pma_client;
mod read_zip;

use crate::pma_client::PMAClient;
use command::Command;
use export::{export, export_all};
use pma_client::PMAConfig;

pub use command::Opt;

pub async fn run(opt: Opt) -> anyhow::Result<()> {
    let client = PMAClient::new(PMAConfig {
        url: opt.url,
        lang: opt.lang,
    });
    match opt.command {
        Command::Export {
            tables,
            export_option,
        } => export(client, tables, export_option).await?,

        Command::ExportAll { export_option } => export_all(client, export_option).await?,
    }
    Ok(())
}