A simple CLI tool to generate boilerplate code for GoF Design Patterns.
- Clone this repository.
- Install dependencies:
pip install -r requirements.txt
To run dp-gen from anywhere:
- Navigate to the project directory.
- Install in editable mode (add
--break-system-packagesif on Linux and not in a venv):pip install -e . --break-system-packages
Now you can just type dp-gen in any terminal!
Generate a design pattern boilerplate:
dp-gen make strategy --lang csharpGenerate a pattern with a custom name:
dp-gen make strategy Payment --lang csharpOutput directory:
python3 dp_gen.py make factory MyFactory --lang csharp --out ./outputstrategy(C#, Python)factory(C#)observer(C#)singleton(C#)decorator(C#)
Add your Jinja2 templates to templates/<language>/<pattern>/. Use {{ name }} for the custom name provided by the user.