dm-database-sqllog2db 0.2.0

命令行工具:将达梦 SQL 日志解析并导出为 CSV 或嵌入式数据库 (SQLite)。
Documentation
use clap::{Parser, Subcommand};

/// SQL log exporter tool
#[derive(Debug, Parser)]
#[command(name = "sqllog2db", version, about = "SQL log exporter tool")]
pub struct Cli {
    #[command(subcommand)]
    pub command: Option<Commands>,
}

#[derive(Debug, Subcommand)]
pub enum Commands {
    /// Run the log export task
    Run {
        /// Configuration file path
        #[arg(short = 'c', long = "config", default_value = "config.toml")]
        config: String,
    },
    /// Generate a default configuration file
    Init {
        /// Output configuration file path
        #[arg(short = 'o', long = "output", default_value = "config.toml")]
        output: String,
        /// Force overwrite if file exists
        #[arg(short = 'f', long = "force")]
        force: bool,
    },
    /// Validate a configuration file
    Validate {
        /// Configuration file path
        #[arg(short = 'c', long = "config", default_value = "config.toml")]
        config: String,
    },
}