Test 2
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"project_slug": "sample",
|
"project_slug": "sample",
|
||||||
"foo": "bar"
|
"use_database": true,
|
||||||
|
"use_cache": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
|
|
||||||
print("{{cookiecutter.project_slug}}")
|
print("{{cookiecutter.project_slug}}")
|
||||||
|
|
||||||
{% if cookiecutter.foo == "bar" %}
|
{% if cookiecutter.use_database %}
|
||||||
print("{{cookiecutter.foo}}")
|
print("Framework will use database")
|
||||||
{% else %}
|
{% else %}
|
||||||
# print("{{cookiecutter.foo}}")
|
print("Framework will not use database")
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if cookiecutter.use_cache %}
|
||||||
|
print("Framework will use cache")
|
||||||
|
{% else %}
|
||||||
|
print("Framework will not use cache")
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
32
main.py
32
main.py
@@ -1,6 +1,30 @@
|
|||||||
|
import typer
|
||||||
from cookiecutter.main import cookiecutter
|
from cookiecutter.main import cookiecutter
|
||||||
|
|
||||||
cookiecutter("cookiecutter-test",
|
# cookiecutter("cookiecutter-test",
|
||||||
# directory=".",
|
# # directory=".",
|
||||||
extra_context={"foo": "quz"},
|
# extra_context={"foo": "quz"},
|
||||||
output_dir="test_output")
|
# output_dir="test_output")
|
||||||
|
|
||||||
|
|
||||||
|
app = typer.Typer()
|
||||||
|
|
||||||
|
|
||||||
|
@app.command()
|
||||||
|
def create_project(project_name: str,
|
||||||
|
template: str = "cookiecutter-test",
|
||||||
|
output_dir: str = ".",
|
||||||
|
use_database: bool = True,
|
||||||
|
use_cache: bool = True,
|
||||||
|
):
|
||||||
|
typer.echo(f"Creating project {project_name}")
|
||||||
|
cookiecutter(template,
|
||||||
|
extra_context={
|
||||||
|
"use_database": use_database,
|
||||||
|
"use_cache": use_cache,
|
||||||
|
},
|
||||||
|
output_dir=output_dir)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app()
|
||||||
|
|||||||
Reference in New Issue
Block a user