summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-20 18:57:03 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-20 18:57:03 -0600
commitac0a019605e951e1177d4f721bd4174f3c4b53a3 (patch)
treebbaae36beefd13954aab1d5a38e55ae1727588aa
parentbb978e591b08b3388345c848fb866c22239094ac (diff)
downloadfreeipa-ac0a019605e951e1177d4f721bd4174f3c4b53a3.tar.gz
freeipa-ac0a019605e951e1177d4f721bd4174f3c4b53a3.tar.xz
freeipa-ac0a019605e951e1177d4f721bd4174f3c4b53a3.zip
Reworked 'plugins' command to use output_for_cli()
-rw-r--r--ipalib/cli.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 7148afc1c..365eea20a 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -154,25 +154,28 @@ class plugins(text_ui):
"""Show all loaded plugins"""
def run(self):
+ plugins = sorted(self.api.plugins, key=lambda o: o.plugin)
+ return tuple(
+ (p.plugin, p.bases) for p in plugins
+ )
+
+ def output_for_cli(self, result):
self.print_name()
first = True
- for p in sorted(self.api.plugins, key=lambda o: o.plugin):
+ for (plugin, bases) in result:
if first:
first = False
else:
print ''
- print ' plugin: %s' % p.plugin
- print ' in namespaces: %s' % ', '.join(p.bases)
- if len(self.api.plugins) == 1:
+ print ' Plugin: %s' % plugin
+ print ' In namespaces: %s' % ', '.join(bases)
+ if len(result) == 1:
s = '1 plugin loaded.'
else:
- s = '%d plugins loaded.' % len(self.api.plugins)
+ s = '%d plugins loaded.' % len(result)
self.print_dashed(s)
-
-
-
cli_application_commands = (
help,
console,