summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
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)