* -c [--component] option for info command. Can be used with multiple -c

as in:

     pisi info -c desktop.kde -c system.base amarok openoffice
This commit is contained in:
Faik Uygur
2006-11-04 21:27:38 +00:00
parent 2fde5afc40
commit d557380613
+24 -15
View File
@@ -801,6 +801,8 @@ Usage: info <package1> <package2> ... <packagen>
group.add_option("-f", "--files", action="store_true", group.add_option("-f", "--files", action="store_true",
default=False, default=False,
help=_("Show a list of package files.")) help=_("Show a list of package files."))
group.add_option("-c", "--component", action="append",
default=None, help=_("Info about the given component"))
group.add_option("-F", "--files-path", action="store_true", group.add_option("-F", "--files-path", action="store_true",
default=False, default=False,
help=_("Show only paths.")) help=_("Show only paths."))
@@ -813,28 +815,34 @@ Usage: info <package1> <package2> ... <packagen>
self.init(database = True, write = False) self.init(database = True, write = False)
if len(self.args) == 0: components = ctx.get_option('component')
if not components and not self.args:
self.help() self.help()
return return
index = pisi.index.Index() index = pisi.index.Index()
index.distribution = None index.distribution = None
for arg in self.args: # info of components
if ctx.componentdb.has_component(arg): if components:
component = ctx.componentdb.get_union_comp(arg) for name in components:
if self.options.xml: if ctx.componentdb.has_component(name):
index.add_component(component) component = ctx.componentdb.get_union_comp(name)
else: if self.options.xml:
if not self.options.short: index.add_component(component)
ctx.ui.info(unicode(component))
else: else:
ctx.ui.info("%s - %s" % (component.name, component.summary)) if not self.options.short:
else: # then assume it was a package ctx.ui.info(unicode(component))
if self.options.xml: else:
index.packages.append(pisi.api.info(arg)[0].package) ctx.ui.info("%s - %s" % (component.name, component.summary))
else:
self.info_package(arg) # info of packages
for arg in self.args:
if self.options.xml:
index.packages.append(pisi.api.info(arg)[0].package)
else:
self.info_package(arg)
if self.options.xml: if self.options.xml:
errs = [] errs = []
index.newDocument() index.newDocument()
@@ -1462,6 +1470,7 @@ in summary, description, and package name fields.
super(Search, self).add_options(group) super(Search, self).add_options(group)
group.add_option("-L", "--language", action="store", group.add_option("-L", "--language", action="store",
help=_("Set search language")) help=_("Set search language"))
group.remove_option("--component")
group.remove_option("--short") group.remove_option("--short")
group.remove_option("--xml") group.remove_option("--xml")
group.add_option("-l", "--long", action="store_true", group.add_option("-l", "--long", action="store_true",