[CLI] generate entity file for specified tables only (full text matching, not substring matching) (#1245)

This commit is contained in:
Billy Chan 2022-11-24 12:21:16 +08:00 committed by GitHub
parent cd672514ab
commit d30a5612f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 13 deletions

View File

@ -141,7 +141,7 @@ pub enum GenerateSubcommands {
takes_value = true, takes_value = true,
help = "Generate entity file for specified tables only (comma separated)" help = "Generate entity file for specified tables only (comma separated)"
)] )]
tables: Option<String>, tables: Vec<String>,
#[clap( #[clap(
value_parser, value_parser,

View File

@ -56,19 +56,8 @@ pub async fn run_generate_command(
// above // above
let is_sqlite = url.scheme() == "sqlite"; let is_sqlite = url.scheme() == "sqlite";
let tables = match tables {
Some(t) => t,
_ => "".to_string(),
};
// Closures for filtering tables // Closures for filtering tables
let filter_tables = |table: &str| -> bool { let filter_tables = |table: &String| -> bool { tables.contains(table) };
if !tables.is_empty() {
return tables.contains(table);
}
true
};
let filter_hidden_tables = |table: &str| -> bool { let filter_hidden_tables = |table: &str| -> bool {
if include_hidden_tables { if include_hidden_tables {