* bump clap to 3.1.17 sea-orm-migration: bump clap version to 3.1.17 sea-orm-cli: use clap derive API instead of builder API sea-orm-migration: use clap derive * Fix clippy warnings * Migration CLI verbose with default value * bump clap to 3.2 Co-authored-by: Thanh Van <tvt@smonv.com> Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
25 lines
651 B
Rust
25 lines
651 B
Rust
use clap::StructOpt;
|
|
use dotenv::dotenv;
|
|
use sea_orm_cli::{handle_error, run_generate_command, run_migrate_command, Cli, Commands};
|
|
|
|
#[async_std::main]
|
|
async fn main() {
|
|
dotenv().ok();
|
|
|
|
let cli = Cli::parse();
|
|
let verbose = cli.verbose;
|
|
|
|
match cli.command {
|
|
Commands::Generate { command } => {
|
|
run_generate_command(command, verbose)
|
|
.await
|
|
.unwrap_or_else(handle_error);
|
|
}
|
|
Commands::Migrate {
|
|
migration_dir,
|
|
command,
|
|
} => run_migrate_command(command, migration_dir.as_str(), verbose)
|
|
.unwrap_or_else(handle_error),
|
|
}
|
|
}
|