Initial commit: mycli toolkit with all commands
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""Utility commands."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import click
|
||||
|
||||
from mycli.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")
|
||||
Reference in New Issue
Block a user