Move enforce_wrapper() into appropiate CMDs. This speeds up --help as a side effect!
This commit is contained in:
parent
18c689f897
commit
f3794f939e
11 changed files with 34 additions and 25 deletions
13
cache.py
13
cache.py
|
@ -1,6 +1,9 @@
|
|||
import shutil
|
||||
import click
|
||||
import os
|
||||
from config import config
|
||||
from wrapper import enforce_wrap
|
||||
import logging
|
||||
|
||||
|
||||
@click.group(name='cache')
|
||||
|
@ -8,15 +11,15 @@ def cmd_cache():
|
|||
pass
|
||||
|
||||
|
||||
@click.command(name='clean')
|
||||
@cmd_cache.command(name='clean')
|
||||
def cmd_clean():
|
||||
for dir in ['/chroot', '/var/cache/pacman/pkg', '/var/cache/jumpdrive']:
|
||||
enforce_wrap()
|
||||
for path_name in ['chroots', 'pacman', 'jumpdrive']:
|
||||
dir = config.file['paths'][path_name]
|
||||
for file in os.listdir(dir):
|
||||
path = os.path.join(dir, file)
|
||||
logging.debug('Removing "{path}"')
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
else:
|
||||
os.unlink(path)
|
||||
|
||||
|
||||
cmd_cache.add_command(cmd_clean)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue