From 962d89524912e1c59619545b27f5346706053484 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 16 Sep 2021 10:14:01 +0800 Subject: [PATCH 1/3] Add CLI verbose option --- sea-orm-cli/Cargo.toml | 5 ++++- sea-orm-cli/src/cli.rs | 8 ++++++++ sea-orm-cli/src/main.rs | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/sea-orm-cli/Cargo.toml b/sea-orm-cli/Cargo.toml index 4c23912c..0191d055 100644 --- a/sea-orm-cli/Cargo.toml +++ b/sea-orm-cli/Cargo.toml @@ -22,13 +22,16 @@ clap = { version = "^2.33.3" } dotenv = { version = "^0.15" } async-std = { version = "^1.9", features = [ "attributes" ] } sea-orm-codegen = { version = "^0.2.0", path = "../sea-orm-codegen" } -sea-schema = { version = "^0.2.7", git = "https://github.com/SeaQL/sea-schema.git", default-features = false, features = [ +sea-schema = { version = "^0.2.7", git = "https://github.com/SeaQL/sea-schema.git", branch = "log", default-features = false, features = [ + "debug-print", "sqlx-mysql", "sqlx-postgres", "discovery", "writer", ] } sqlx = { version = "^0.5", default-features = false, features = [ "mysql", "postgres" ] } +env_logger = { version = "^0.9" } +log = { version = "^0.4" } [features] default = [ "runtime-async-std-native-tls" ] diff --git a/sea-orm-cli/src/cli.rs b/sea-orm-cli/src/cli.rs index 400374c5..100c747c 100644 --- a/sea-orm-cli/src/cli.rs +++ b/sea-orm-cli/src/cli.rs @@ -62,5 +62,13 @@ pub fn build_cli() -> App<'static, 'static> { .version(env!("CARGO_PKG_VERSION")) .setting(AppSettings::VersionlessSubcommands) .subcommand(entity_subcommand) + .arg( + Arg::with_name("VERBOSE") + .long("verbose") + .short("v") + .help("Show debug messages") + .takes_value(false) + .global(true), + ) .setting(AppSettings::SubcommandRequiredElseHelp) } diff --git a/sea-orm-cli/src/main.rs b/sea-orm-cli/src/main.rs index 2f51aefb..e7041ef0 100644 --- a/sea-orm-cli/src/main.rs +++ b/sea-orm-cli/src/main.rs @@ -1,5 +1,6 @@ use clap::ArgMatches; use dotenv::dotenv; +use log::LevelFilter; use sea_orm_codegen::{EntityTransformer, OutputFile}; use std::{error::Error, fmt::Display, fs, io::Write, path::Path, process::Command}; @@ -33,6 +34,12 @@ async fn run_generate_command(matches: &ArgMatches<'_>) -> Result<(), Box Date: Fri, 17 Sep 2021 12:23:06 +0800 Subject: [PATCH 2/3] Update Cargo.toml --- sea-orm-cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sea-orm-cli/Cargo.toml b/sea-orm-cli/Cargo.toml index 0191d055..0392f51e 100644 --- a/sea-orm-cli/Cargo.toml +++ b/sea-orm-cli/Cargo.toml @@ -22,7 +22,7 @@ clap = { version = "^2.33.3" } dotenv = { version = "^0.15" } async-std = { version = "^1.9", features = [ "attributes" ] } sea-orm-codegen = { version = "^0.2.0", path = "../sea-orm-codegen" } -sea-schema = { version = "^0.2.7", git = "https://github.com/SeaQL/sea-schema.git", branch = "log", default-features = false, features = [ +sea-schema = { version = "^0.2.7", git = "https://github.com/SeaQL/sea-schema.git", default-features = false, features = [ "debug-print", "sqlx-mysql", "sqlx-postgres", From 51a690ba995ce2c7214f84e57a479de62f81f3f4 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Fri, 17 Sep 2021 12:26:31 +0800 Subject: [PATCH 3/3] Update Cargo.toml --- sea-orm-cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sea-orm-cli/Cargo.toml b/sea-orm-cli/Cargo.toml index 0392f51e..484b6efb 100644 --- a/sea-orm-cli/Cargo.toml +++ b/sea-orm-cli/Cargo.toml @@ -22,7 +22,7 @@ clap = { version = "^2.33.3" } dotenv = { version = "^0.15" } async-std = { version = "^1.9", features = [ "attributes" ] } sea-orm-codegen = { version = "^0.2.0", path = "../sea-orm-codegen" } -sea-schema = { version = "^0.2.7", git = "https://github.com/SeaQL/sea-schema.git", default-features = false, features = [ +sea-schema = { version = "^0.2.8", git = "https://github.com/SeaQL/sea-schema.git", default-features = false, features = [ "debug-print", "sqlx-mysql", "sqlx-postgres",