From 576442e70b2b0ffce4e6efd8308502c79b9bdd87 Mon Sep 17 00:00:00 2001 From: Morgan Williams <2504532+mrgnw@users.noreply.github.com> Date: Fri, 25 Sep 2026 23:40:15 -0400 Subject: [PATCH] _devcleanup: offer to delete Xcode simulator runtimes at the end Co-Authored-By: Claude Opus 5.5 --- _devcleanup | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/_devcleanup b/_devcleanup index 4c66055..39979d8 100755 --- a/_devcleanup +++ b/_devcleanup @@ -214,7 +214,7 @@ def delete_directories(dirs_to_delete: List[DirectorySize]) -> None: console.print("[bold green]✓ Processing complete![/bold green]") -def main(): +def clean_dirs(): root = Path.cwd() if not root.exists(): @@ -287,5 +287,29 @@ def main(): delete_directories(selected) +def simulator_runtimes_summary() -> str | None: + if shutil.which("xcrun") is None: + return None + result = subprocess.run(["xcrun", "simctl", "runtime", "list"], capture_output=True, text=True) + for line in result.stdout.splitlines(): + if line.startswith("Total Disk Images:") and not line.startswith("Total Disk Images: 0"): + return line.removeprefix("Total Disk Images: ") + return None + + +def offer_xcode_sims() -> None: + summary = simulator_runtimes_summary() + if summary is None: + return + console.print() + if questionary.confirm(f"Delete Xcode simulator runtimes? {summary}", default=False).ask(): + subprocess.run(["xcode-sims", "off"], check=True) + + +def main(): + clean_dirs() + offer_xcode_sims() + + if __name__ == "__main__": main() -- knotmirror 0.0.1