kupferbootstrap/cache.py

23 lines
454 B
Python
Raw Normal View History

2021-08-04 18:36:37 +02:00
import shutil
import click
import os
@click.group(name='cache')
def cmd_cache():
pass
@click.command(name='clean')
def cmd_clean():
for dir in ['/chroot', '/var/cache/pacman/pkg', '/var/cache/jumpdrive']:
2021-08-04 18:36:37 +02:00
for file in os.listdir(dir):
path = os.path.join(dir, file)
if os.path.isdir(path):
shutil.rmtree(path)
else:
os.unlink(path)
cmd_cache.add_command(cmd_clean)