mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
App.distro_info(): Accept and return lists
App.distro_info() accepts and returns str instances, interpret anything passed as fmt parameter which is not a str as iterable, and return lists of expanded strings in that case. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
a19679fecc
commit
c20091d7ac
1 changed files with 7 additions and 2 deletions
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Iterable
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import TypeAlias
|
||||
|
|
@ -418,7 +418,12 @@ class App(Base):
|
|||
self.__distro = ret
|
||||
return self.__distro
|
||||
|
||||
def distro_info(self, fmt: str) -> str:
|
||||
def distro_info(self, fmt: str|Iterable) -> str|Iterable:
|
||||
if not isinstance(fmt, str):
|
||||
ret: list[str] = []
|
||||
for entry in fmt:
|
||||
ret.append(self.distro_info(entry))
|
||||
return ret
|
||||
ret = fmt
|
||||
for macro in re.findall("%{([A-Za-z_-]+)}", fmt):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue