Add scaffold parent selection: --dir defaults to cwd

This commit is contained in:
jay
2026-11-09 13:30:42 -05:00
parent 29306b0f25
commit a57075dc2d
2 changed files with 28 additions and 1 deletions
+9
View File
@@ -25,3 +25,12 @@ def target_dir(name: str, parent: Path) -> Path:
if target.exists():
raise ScaffoldError(f"target directory already exists: {target}")
return target
def parent_dir(explicit: Path | None) -> Path:
"""Return the parent for a new project: *explicit* when given, else cwd."""
if explicit is None:
return Path.cwd()
if not explicit.is_dir():
raise ScaffoldError(f"--dir is not an existing directory: {explicit}")
return explicit