martenframework / marten

The pragmatic web framework.
https://martenframework.com
MIT License
405 stars 23 forks source link

Introduce generators #121

Closed ellmetha closed 8 months ago

ellmetha commented 1 year ago

Description

Marten presently allows to generate new repository structures (projects or applications) easily through the use of the new, but there is no way to easily generate specific abstractions (such as models, handlers, schemas) or in-project structures (such as in-project applications) easily.

To palliate this, let's introduce a new gen management command (aliased g) that will allow to respond to this need. This is also something that people have been asking for since the initial release of Marten, and it should make it easier to work with the framework.

The gen management command

The gen management command should leverage an underlying generator mechanism that projects should be able to extend should they need to define custom generators. The way to call this new management command would be:

marten gen <generator> <arguments>

By default, the following generators should be made available by the Marten framework:

For the applicable generators that can write to project applications: specifying a target application should be optional, and if not specified the target application should default to the main application (src folder).

Documentation

The following changes should be introduced in the documentation: