mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-25 17:45:55 +02:00
jw.pkg.cmds.distro.CmdDelete: Add command
Add command to delete named packages, along with an implementation for OpenSUSE. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
3ceb2b71b7
commit
4153fa7c05
3 changed files with 48 additions and 0 deletions
18
src/python/jw/pkg/cmds/distro/CmdDelete.py
Normal file
18
src/python/jw/pkg/cmds/distro/CmdDelete.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from argparse import Namespace, ArgumentParser
|
||||||
|
|
||||||
|
from .Cmd import Cmd
|
||||||
|
from ..CmdDistro import CmdDistro
|
||||||
|
|
||||||
|
class CmdDelete(Cmd): # export
|
||||||
|
|
||||||
|
def __init__(self, parent: CmdDistro) -> None:
|
||||||
|
super().__init__(parent, 'delete', help="Delete packages by name")
|
||||||
|
|
||||||
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
|
super().add_arguments(parser)
|
||||||
|
parser.add_argument("packages", nargs="*", help="Names of packages to be deleted")
|
||||||
|
|
||||||
|
async def _run(self, args: Namespace) -> None:
|
||||||
|
return await self._backend.run(args)
|
||||||
16
src/python/jw/pkg/cmds/distro/backend/BeDelete.py
Normal file
16
src/python/jw/pkg/cmds/distro/backend/BeDelete.py
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import abc
|
||||||
|
from argparse import Namespace
|
||||||
|
|
||||||
|
from .Backend import Backend as Base
|
||||||
|
from ..CmdDelete import CmdDelete as Parent
|
||||||
|
|
||||||
|
class BeDelete(Base):
|
||||||
|
|
||||||
|
def __init__(self, parent: Parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
async def run(self, args: Namespace) -> None:
|
||||||
|
pass
|
||||||
14
src/python/jw/pkg/cmds/distro/backend/suse/Delete.py
Normal file
14
src/python/jw/pkg/cmds/distro/backend/suse/Delete.py
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from argparse import Namespace
|
||||||
|
|
||||||
|
from ...Cmd import Cmd
|
||||||
|
from ..BeDelete import BeDelete as Base
|
||||||
|
|
||||||
|
class Delete(Base):
|
||||||
|
|
||||||
|
def __init__(self, parent: Cmd):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
async def run(self, args: Namespace):
|
||||||
|
return await self.util.rpm('-e', *args.packages, sudo=True)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue