Skip to content

Commit

Permalink
[CLI] generate entity file for specified tables only (full text match…
Browse files Browse the repository at this point in the history
…ing, not substring matching) (#1245)
  • Loading branch information
billy1624 authored and tyt2y3 committed Nov 24, 2022
1 parent 0eccbc9 commit 4e6e23b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion sea-orm-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub enum GenerateSubcommands {
takes_value = true,
help = "Generate entity file for specified tables only (comma separated)"
)]
tables: Option<String>,
tables: Vec<String>,

#[clap(
value_parser,
Expand Down
13 changes: 1 addition & 12 deletions sea-orm-cli/src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4e6e23b

Please sign in to comment.