- 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
33 lines
707 B
Python
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")
|