jw.pkg.cmds.distro.backend.Util: Add class

Add a common base class for all jw.pkg.cmds.distro.backend.*.Util
classes.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-02-17 12:31:29 +01:00
commit 3c8f57f636

View file

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
from __future__ import annotations
from typing import TYPE_CHECKING
from ....lib.util import run_cmd, run_sudo
if TYPE_CHECKING:
from ..Cmd import Cmd
class Util:
def __init__(self, parent: Cmd):
self.__parent = parent
async def _sudo(self, cmd: list[str], mod_env: dict[str, str] = {}, opts: list[str]=[]):
return await run_sudo(cmd, mod_env=mod_env, opts=opts, interactive=self.interactive)
@property
def parent(self):
return self.__parent
@property
def interactive(self) -> bool:
return self.__parent.interactive