mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
To be able to use secret handling code from other modules, move the bulk of it from the "secrets"-command centric implementation in cmds.secrets.Cmd into a new module cmds.secrets.lib.util. Signed-off-by: Jan Lindemann <jan@janware.com>
41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from ..Cmd import Cmd as Base
|
|
|
|
if TYPE_CHECKING:
|
|
from typing import Iterable
|
|
from ...lib.Distro import Distro
|
|
from ..CmdDistro import CmdDistro
|
|
|
|
from .lib.util import *
|
|
|
|
class Cmd(Base): # export
|
|
|
|
async def _match_files(self, packages: Iterable[str], pattern: str) -> list[str]:
|
|
return await match_files(self.distro, packages, pattern)
|
|
|
|
async def _list_template_files(self, packages: Iterable[str]) -> list[str]:
|
|
return await list_template_files(self.distro, packages)
|
|
|
|
async def _list_secret_paths(self, packages: Iterable[str], ignore_missing: bool=False) -> list[str]:
|
|
return await list_secret_paths(self.distro, packages, ignore_missing)
|
|
|
|
async def _list_compilation_targets(self, packages: Iterable[str], ignore_missing: bool=False) -> list[str]:
|
|
return await list_compilation_targets(self.distro, packages, ignore_missing)
|
|
|
|
async def _remove_compilation_targets(self, packages: Iterable[str]) -> list[str]:
|
|
return await remove_compilation_targets(self.distro, packages)
|
|
|
|
async def _compile_template_files(self, packages: Iterable[str], default_attrs: Attrs) -> list[str]:
|
|
return await compile_template_files(self.distro, packages, default_attrs)
|
|
|
|
def __init__(self, parent: CmdDistro, 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")
|