summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-24 04:44:52 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-24 04:44:52 +0000
commit3e70c3b56b29dcc9c0f6dd15eee7d4a24945944a (patch)
tree8f95bee2fb1e5919862e0d4795d1b73e3bbccd55 /ipalib/cli.py
parent3bf2da571488b6f1ef27527fa3bff0133b44c2f5 (diff)
downloadfreeipa-3e70c3b56b29dcc9c0f6dd15eee7d4a24945944a.tar.gz
freeipa-3e70c3b56b29dcc9c0f6dd15eee7d4a24945944a.tar.xz
freeipa-3e70c3b56b29dcc9c0f6dd15eee7d4a24945944a.zip
325: API.finalize() now creates instance attribtue 'plugins', which is a tuple of PluginInfo objects; renamed show_plugins cli command to namespaces; added new cli command plugins
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py36
1 files changed, 31 insertions, 5 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index a76c08bc..7912f1b1 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -77,8 +77,8 @@ class console(frontend.Application):
)
-class show_plugins(frontend.Application):
- 'Print details on the loaded plugins.'
+class namespaces(frontend.Application):
+ 'Show details of plugable namespaces'
def run(self):
lines = self.__traverse()
@@ -112,6 +112,33 @@ class show_plugins(frontend.Application):
self.__traverse_namespace(n, attr, lines, tab + 2)
+class plugins(frontend.Application):
+ """Show all loaded plugins"""
+
+ def run(self):
+ print '%s:\n' % self.name
+ for p in sorted(self.api.plugins, key=lambda o: o.plugin):
+ print ' plugin: %s' % p.plugin
+ print ' in namespaces: %s' % ', '.join(p.bases)
+ print ''
+ if len(self.api.plugins) == 1:
+ print '1 plugin loaded.'
+ else:
+ print '%d plugins loaded.' % len(self.api.plugins)
+
+
+
+
+
+cli_application_commands = (
+ help,
+ console,
+ namespaces,
+ plugins,
+
+)
+
+
class KWCollector(object):
def __init__(self):
object.__setattr__(self, '_KWCollector__d', {})
@@ -168,9 +195,8 @@ class CLI(object):
def finalize(self):
api = self.api
- api.register(help)
- api.register(console)
- api.register(show_plugins)
+ for klass in cli_application_commands:
+ api.register(klass)
api.finalize()
for a in api.Application():
a.set_application(self)