from __future__ import annotations from argparse import ArgumentParser from functools import cached_property from typing import TYPE_CHECKING from ...CmdBase import CmdBase from ..CmdSecrets import CmdSecrets as Parent if TYPE_CHECKING: from typing import Iterable from .lib.base import Attrs from .lib.DistroContext import DistroContext class Cmd(CmdBase): # export @cached_property def ctx(self) -> DistroContext: return DistroContext(self.app.distro) async def _match_files(self, packages: Iterable[str], pattern: str) -> list[str]: return await self.ctx.match_files(packages, pattern) async def _list_template_files(self, packages: Iterable[str]) -> list[str]: return await self.ctx.list_template_files(packages) async def _list_secret_paths( self, packages: Iterable[str], ignore_missing: bool = False ) -> list[str]: return await self.ctx.list_secret_paths(packages, ignore_missing) async def _list_compilation_targets( self, packages: Iterable[str], ignore_missing: bool = False ) -> list[str]: return await self.ctx.list_compilation_targets(packages, ignore_missing) async def _remove_compilation_targets(self, packages: Iterable[str]) -> list[str]: return await self.ctx.remove_compilation_targets(packages) async def _compile_template_files( self, packages: Iterable[str], default_attrs: Attrs ) -> list[str]: return await self.ctx.compile_template_files(packages, default_attrs) def __init__(self, parent: Parent, name: str, help: str) -> None: super().__init__(parent, name, help) def add_arguments(self, parser: ArgumentParser) -> None: super().add_arguments(parser) parser.add_argument('packages', nargs = '*', help = 'Package names')