diff --git a/src/python/jw/pkg/cmds/distro/backend/Util.py b/src/python/jw/pkg/cmds/distro/backend/Util.py new file mode 100644 index 00000000..7a4fbc8d --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/Util.py @@ -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