interactive: list_spi: Accept and split string as first argument

Use case: to show info on all packages in your clipboard, do:

>>> list_spi('''
... <paste>
... ''')
This commit is contained in:
Ivan A. Melnikov 2019-03-19 18:15:39 +04:00
parent a46ff4b5d4
commit 573ff92a85

View File

@ -170,6 +170,8 @@ g = gspi # noqa
def list_spi(pkgs, colors=None, to=print):
if isinstance(pkgs, basestring):
pkgs = pkgs.split()
pset = frozenset(pkgs)
lines = _spi_by_predicate(pset.__contains__, colors)
unknown = pset - frozenset(BY_NAME)