refactor(clew): rename force flag to overwrite

This commit is contained in:
2026-09-07 14:40:45 -04:00
parent 48bd0cd374
commit 24a7c2783f

View File

@@ -31,7 +31,7 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
help="Output root. Defaults to repository output/.",
)
parser.add_argument(
"--force",
"--overwrite",
action="store_true",
help="Replace Clew-managed output directories.",
)
@@ -54,13 +54,13 @@ def resolve_output_root(output_root: Path) -> Path:
return output_root.resolve()
def prepare_output(output_root: Path, force: bool) -> tuple[Path, Path]:
def prepare_output(output_root: Path, overwrite: bool) -> tuple[Path, Path]:
for name in MANAGED_DIRS:
path = output_root / name
if path.exists() and not force:
if path.exists() and not overwrite:
raise SystemExit(f"clew: refusing to overwrite existing output path: {path}")
if force:
if overwrite:
for name in MANAGED_DIRS:
shutil.rmtree(output_root / name, ignore_errors=True)
@@ -135,7 +135,7 @@ def run(args: argparse.Namespace) -> None:
raise SystemExit(f"clew: game root is not a directory: {game_root}")
suffixes = normalize_suffixes(args.suffix)
extracted_dir, logs_dir = prepare_output(output_root, args.force)
extracted_dir, logs_dir = prepare_output(output_root, args.overwrite)
configure_logging(logs_dir)
LOGGER.info("copying loose files")