From 98a72b00c170c509bfb9a4640090391cf0a7fb69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 14 Nov 2005 15:46:54 +0000 Subject: [PATCH] * new command list-components --- pisi/cli/commands.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 88036ab6..19ee2067 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -768,7 +768,7 @@ class ListAvailable(Command): Usage: list-available [ ... repon ] -Gives a brief list of PiSi components published in the repository. +Gives a brief list of PiSi packages published in the repository. """ __metaclass__ = autocommand @@ -814,6 +814,41 @@ Gives a brief list of PiSi components published in the repository. p = p + ' ' * max(0, 15 - lenp) ctx.ui.info('%s - %s ' % (p, unicode(package.summary))) +class ListComponents(Command): + """List available components + +Usage: list-components + +Gives a brief list of PiSi components published in the repositories. +""" + __metaclass__ = autocommand + + def __init__(self): + super(ListComponents, self).__init__() + + name = ("list-components", "lc") + + def options(self): + self.parser.add_option("-l", "--long", action="store_true", + default=False, help="show in long format") + + def run(self): + + self.init(True) + + list = ctx.componentdb.list_components() + list.sort() + for p in list: + component = ctx.componentdb.get_component(p) + if self.options.long: + ctx.ui.info(unicode(component)) + else: + lenp = len(p) + #if p in installed_list: + # p = colorize(p, 'cyan') + p = p + ' ' * max(0, 15 - lenp) + ctx.ui.info('%s - %s ' % (component.name, unicode(component.summary))) + self.finalize() class ListUpgrades(Command): """List packages to be upgraded