use std::path::PathBuf;
use std::time::Duration;
use clap::{Parser, Subcommand, ValueEnum};
#[derive(Debug, Parser)]
#[command(name = "sqlload", version, about)]
pub struct Cli {
#[arg(
long,
short,
global = true,
default_value = "sqlload.toml",
env = "SQLLOAD_CONFIG"
)]
pub config: PathBuf,
#[arg(long, global = true, value_enum, default_value_t = LogFormat::Text)]
pub log_format: LogFormat,
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
Check,
Plan,
Tables {
#[arg(long)]
topics_file: Option<PathBuf>,
},
Apply,
Run {
#[arg(long, value_parser = humantime::parse_duration)]
max_duration: Option<Duration>,
#[arg(long, env = "SQLLOAD_SHARD")]
shard: Option<u32>,
},
Status,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
pub enum LogFormat {
Text,
Json,
}