use clap::Parser;
use akita_codegen::config::{AutoGenerator, prompt_for_config_path_or_default};
#[derive(Parser, Debug)]
#[command(author = "Mr.Pan", version = "0.5.0", about = "Akita Template Generator CLI Tool")]
struct Args {
#[arg(short, long)]
config: Option<String>,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
print_copyright();
let args = Args::parse();
let config_path = match args.config {
Some(path) => path, None => prompt_for_config_path_or_default("Please enter the configuration file path (press Enter to use default 'config.yaml')\n: ","config.yaml")?, };
AutoGenerator::load_or_create_config(&config_path)
.execute();
println!("AutoGenerator executed successfully\n");
Ok(())
}
fn print_copyright() {
eprintln!(
r#"
█████╗ ██╗ ██╗██╗████████╗ █████╗
██╔══██╗██║ ██║██║╚══██╔══╝██╔══██╗
███████║███████║██║ ██║ ███████║
██╔══██║██╔══██║██║ ██║ ██╔══██║
██║ ██║██║ ██║██║ ██║ ██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝
Akita - Database Template Engine
Author : Mr.Pan
Version : 0.6.0
License : MIT
"#
);
}