mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-28 13:55:24 +02:00
jw/pkg/cmds/distro/CmdPkg: Add distro pkg ls
Add the distro subcommand class CmdPkg, together with a first subcommand ls, which prints a list of files contained in a package. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
aebd9bb5e6
commit
881a915098
6 changed files with 98 additions and 0 deletions
24
src/python/jw/pkg/cmds/distro/backend/BePkg.py
Normal file
24
src/python/jw/pkg/cmds/distro/backend/BePkg.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import abc
|
||||
from typing import Iterable
|
||||
|
||||
from .Backend import Backend as Base
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..CmdPkg import CmdPkg as Parent
|
||||
|
||||
class BePkg(Base):
|
||||
|
||||
def __init__(self, parent: Parent):
|
||||
super().__init__(parent)
|
||||
|
||||
async def list_files(self, name: str) -> Iterable[str]:
|
||||
return await self._list_files(name)
|
||||
|
||||
@abc.abstractmethod
|
||||
async def _list_files(self, name: str) -> Iterable[str]:
|
||||
pass
|
||||
17
src/python/jw/pkg/cmds/distro/backend/suse/Pkg.py
Normal file
17
src/python/jw/pkg/cmds/distro/backend/suse/Pkg.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Iterable
|
||||
from argparse import Namespace
|
||||
|
||||
from ...lib.Package import Package
|
||||
from ...lib.rpm import list_files
|
||||
from ...Cmd import Cmd
|
||||
from ..BePkg import BePkg as Base
|
||||
|
||||
class Pkg(Base):
|
||||
|
||||
def __init__(self, parent: Cmd):
|
||||
super().__init__(parent)
|
||||
|
||||
async def _list_files(self, name: str) -> Iterable[Package]:
|
||||
return await list_files(name)
|
||||
Loading…
Add table
Add a link
Reference in a new issue