diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-04 04:39:01 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-04 04:39:01 +0000 |
commit | ab81ca56fd336af4b83ef19a6f97dffe0b1a0923 (patch) | |
tree | 05bebd08f4ae1672b2259f797613346745bb8272 /ipalib/cli.py | |
parent | e1f8619d4adbc15415e2959496640c0f707c54fe (diff) | |
download | freeipa-ab81ca56fd336af4b83ef19a6f97dffe0b1a0923.tar.gz freeipa-ab81ca56fd336af4b83ef19a6f97dffe0b1a0923.tar.xz freeipa-ab81ca56fd336af4b83ef19a6f97dffe0b1a0923.zip |
255: CLI help, console commands now subclass from public.Application; other tweeking to make CLI utilize Application
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r-- | ipalib/cli.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index 989c24f67..e1cbfa78f 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -44,7 +44,7 @@ def from_cli(cli_name): return str(cli_name).replace('-', '_') -class help(public.Command): +class help(public.Application): 'Display help on command' def __call__(self, key): if from_cli(key) not in self.api.Command: @@ -53,7 +53,7 @@ class help(public.Command): print 'Help on command %r:' % key -class console(public.Command): +class console(public.Application): 'Start IPA Interactive Python Console' def __call__(self): @@ -95,10 +95,16 @@ class CLI(object): api.register(help) api.register(console) api.finalize() - def d_iter(): - for cmd in api.Command(): - yield (to_cli(cmd.name), cmd) - self.__d = dict(d_iter()) + for a in api.Application(): + a.set_application(self) + self.build_map() + + def build_map(self): + assert self.__d is None + self.__d = dict( + (c.name.replace('_', '-'), c) for c in self.api.Command() + ) + def run(self): self.finalize() |