ecr.commands.cmd_clean

src/ecr/commands/cmd_clean.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from typing import cast

from .. import shared
from ..core import WorkManager
from ..ui.command import Command, Namespace, ReturnCode
from .helper import assertInited, printFileDelete


class CleanCommand(Command):
    @staticmethod
    def default(args: Namespace)->ReturnCode:  # pylint: disable=W0613
        if not assertInited():
            return ReturnCode.UNLOADED
        tman: WorkManager = cast(WorkManager, shared.getManager())
        tman.clean(rmHandler=printFileDelete)
        return ReturnCode.OK

    def __init__(self):
        super().__init__("clean", help="Clean temp files", func=CleanCommand.default)