From 4e6e23b364dd2d420c333bf7057738ff1343ee37 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 24 Nov 2022 12:21:16 +0800 Subject: [PATCH] [CLI] generate entity file for specified tables only (full text matching, not substring matching) (#1245) --- sea-orm-cli/src/cli.rs | 2 +- sea-orm-cli/src/commands/generate.rs | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/sea-orm-cli/src/cli.rs b/sea-orm-cli/src/cli.rs index edc43a374..1d797aa03 100644 --- a/sea-orm-cli/src/cli.rs +++ b/sea-orm-cli/src/cli.rs @@ -141,7 +141,7 @@ pub enum GenerateSubcommands { takes_value = true, help = "Generate entity file for specified tables only (comma separated)" )] - tables: Option, + tables: Vec, #[clap( value_parser, diff --git a/sea-orm-cli/src/commands/generate.rs b/sea-orm-cli/src/commands/generate.rs index b73fe3c3e..75f61318f 100644 --- a/sea-orm-cli/src/commands/generate.rs +++ b/sea-orm-cli/src/commands/generate.rs @@ -56,19 +56,8 @@ pub async fn run_generate_command( // above let is_sqlite = url.scheme() == "sqlite"; - let tables = match tables { - Some(t) => t, - _ => "".to_string(), - }; - // Closures for filtering tables - let filter_tables = |table: &str| -> bool { - if !tables.is_empty() { - return tables.contains(table); - } - - true - }; + let filter_tables = |table: &String| -> bool { tables.contains(table) }; let filter_hidden_tables = |table: &str| -> bool { if include_hidden_tables {