lib.ExecContext.username: Add property

Add the property .username, backed by the protected _username()
callback. It should return the user run()'s cmd parameter is executed
as.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-04-19 14:03:31 +02:00
commit 9f756222fe
3 changed files with 15 additions and 4 deletions

View file

@ -240,9 +240,13 @@ class ExecContext(Base):
super().__init__(uri=uri, interactive=interactive, verbose_default=verbose_default)
@abc.abstractmethod
async def _run(self, *args, **kwargs) -> Result:
def _username(self) -> str:
pass
@property
def username(self) -> str:
return self._username()
async def run(
self,
cmd: list[str],