Files
mytoolkit/bin/commands/utils.py
T
Zhengshou Lai c1df4098b3 refactor: rename package from mytoolkit to bin
- Move all source files from mytoolkit/ to bin/
- Update entry point and build config in pyproject.toml
- Add pillow and pypdf dependencies
- Update README and .gitignore paths
- Remove unused subprocess import in pdf.py
- Clean up duplicate imports in pdf merge command
2026-04-26 09:56:29 +08:00

33 lines
707 B
Python

"""Utility commands."""
from pathlib import Path
import click
from bin.utils import handle_errors
@click.group()
def utils():
"""Miscellaneous utilities."""
pass
@utils.command("albany-cleanup")
@click.option("--dry-run", "-n", is_flag=True, help="Show what would be done")
@handle_errors
def albany_cleanup(dry_run):
"""Clean up Albany temporary files (phalanx_*)."""
count = 0
for file in Path(".").glob("phalanx_*"):
if dry_run:
click.echo(f"Would remove: {file}")
else:
file.unlink()
count += 1
if dry_run:
click.echo("Dry run completed")
else:
click.echo(f"Removed {count} Albany temporary files")