lib.Distro: Allow empty packages list

In commands taking lists of packages, namely install, delete and
pkg_files, don't bother asking the backend. Uniformly log a warning
and return successfully.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-03-15 15:14:56 +01:00
commit cff63786e9

View file

@ -113,6 +113,9 @@ class Distro(abc.ABC):
pass
async def install(self, names: Iterable[str], only_update: bool=False) -> None:
if not names:
log(WARNING, f'No packages specified for installation')
return
return await self._install(names, only_update=only_update)
# -- delete
@ -122,6 +125,9 @@ class Distro(abc.ABC):
pass
async def delete(self, names: Iterable[str]) -> None:
if not names:
log(WARNING, f'No packages specified for deletion')
return
return await self._delete(names)
# -- pkg_files
@ -131,4 +137,7 @@ class Distro(abc.ABC):
pass
async def pkg_files(self, name: str) -> Iterable[str]:
if not names:
log(WARNING, f'No packages specified for inspection')
return []
return await self._pkg_files(name)