diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-24 04:44:52 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-24 04:44:52 +0000 |
commit | 3e70c3b56b29dcc9c0f6dd15eee7d4a24945944a (patch) | |
tree | 8f95bee2fb1e5919862e0d4795d1b73e3bbccd55 /ipalib/cli.py | |
parent | 3bf2da571488b6f1ef27527fa3bff0133b44c2f5 (diff) | |
download | freeipa-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.py | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index a76c08bcf..7912f1b1c 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) |