Skip to content
Open
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
13 changes: 7 additions & 6 deletions src/stride/cli/stride.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,15 @@ def projects() -> None:
@click.option(
"-o",
"--output",
default="project.json5",
show_default=True,
help="Output filename for the template.",
default=None,
help="Output filename for the template. Defaults to '{country.lower()}_project.json5'.",
type=click.Path(),
callback=path_callback,
)
@click.option(
"--project-id",
default=None,
help="Project ID. Defaults to '{country}_project'.",
help="Project ID. Defaults to '{country.lower()}_project'.",
)
@click.option(
"--overwrite",
Expand All @@ -111,7 +110,7 @@ def projects() -> None:
def init_project(
ctx: click.Context,
country: str,
output: Path,
output: Path | None,
project_id: str | None,
overwrite: bool,
) -> None:
Expand All @@ -121,11 +120,13 @@ def init_project(
"""
from stride.project import generate_project_template

project_id = project_id or f"{country.lower()}_project"
output = output or Path(f"{project_id}.json5")

if output.exists() and not overwrite:
logger.error(f"Output file already exists: {output}. Use --overwrite to replace it.")
ctx.exit(1)

project_id = project_id or f"{country.lower()}_project"
content = generate_project_template(country=country, project_id=project_id)
output.write_text(content)
print(f"Created project template: {output}")
Expand Down
Loading