Allow Custom Filename for Generated Active Enums via CLI Argument
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 734
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
Description
Feature Request: Allow Custom Filename for Generated Active Enums via CLI Argument
Motivation
Currently, the generated file for active enums is always named sea_orm_active_enums.rs.
This makes it harder to integrate with projects that have custom naming conventions or when multiple enum files need to be generated separately.
Allowing the filename to be set dynamically via a CLI argument would give developers more flexibility and better project structure control.
Proposed Solutions
Introduce a new CLI argument (for example --active-enum-file <FILENAME>) to specify the output filename of the active enums.
- Default behavior (no argument provided): still generate
sea_orm_active_enums.rsto maintain backward compatibility. - If the argument is set, use the provided name instead of the hardcoded
"sea_orm_active_enums.rs"string insideEntityWriter::write_sea_orm_active_enums.
This approach preserves existing workflows while enabling customization for advanced use cases.
Additional Information
- Example usage:
sea-orm-cli generate entity --active-enum-file enums.rs
This would result in enums.rs being generated instead of sea_orm_active_enums.rs.
-
The implementation would mainly involve replacing the hardcoded string in
writer.rswith a configurable parameter passed down from the CLI layer. -
Backward compatibility is maintained since the argument would be optional.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the CLI layer for generate entity and trace how arguments reach writer.rs, especially EntityWriter::write_sea_orm_active_enums. Add the optional filename while preserving the default, then verify that the example command generates the requested filename and that the no-argument behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100