Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extract-custom & apply-custom emty subcommands #1940

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions sea-orm-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,26 @@ pub enum GenerateSubcommands {
)]
seaography: bool,
},
#[command(about = "Extract Custom Entity Code")]
ExtractCustom {
#[arg(
short = 'o',
long,
default_value = "./",
help = "Entity file output directory"
)]
output_dir: String,
},
#[command(about = "Apply Custom Entity Code")]
ApplyCustom {
#[arg(
short = 'o',
long,
default_value = "./",
help = "Entity file output directory"
)]
output_dir: String,
},
}

#[derive(Copy, Clone, Debug, PartialEq, Eq, ValueEnum, Default)]
Expand Down
14 changes: 14 additions & 0 deletions sea-orm-cli/src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ pub async fn run_generate_command(

println!("... Done.");
}

GenerateSubcommands::ExtractCustom {
output_dir,
} => {
println!("ExtractCustom: Output directory = {}",output_dir);
}

GenerateSubcommands::ApplyCustom {
output_dir,
} => {
println!("ApplyCustom: Output directory = {}",output_dir);
}
}

Ok(())
Expand Down Expand Up @@ -322,6 +334,8 @@ mod tests {
"sea-orm-cli",
"generate",
"entity",
"extract",
"apply",
"--database-url",
"mysql://root:@localhost:3306/database",
]);
Expand Down