[CLI] generate entity file for specified tables only (full text matching, not substring matching) (#1245)
This commit is contained in:
parent
cd672514ab
commit
d30a5612f8
@ -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,
|
||||||
|
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user