diff options
author | Rob Crittenden <rcritten@redhat.com> | 2009-06-12 13:26:15 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-06-15 14:03:12 -0400 |
commit | e46fd3401e01347765c641e3bc4bc7b63f7c7f23 (patch) | |
tree | f32219a625f6e62e7f2ff1e8d86d3145b09263ca /ipalib/cli.py | |
parent | b83badd73ba1b6529a6d7d7d97a55dfa589afb2e (diff) | |
download | freeipa-e46fd3401e01347765c641e3bc4bc7b63f7c7f23.tar.gz freeipa-e46fd3401e01347765c641e3bc4bc7b63f7c7f23.tar.xz freeipa-e46fd3401e01347765c641e3bc4bc7b63f7c7f23.zip |
Two new arguments for the help built-in command: topics and commands
ipa help topics will show all topics (equivalent to ipa help)
ipa help commands will show list of all available commands
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r-- | ipalib/cli.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index b7f840cf8..6dc0c0682 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -475,16 +475,21 @@ class help(frontend.Command): super(help, self).finalize() def run(self, key): - if key is None: + name = from_cli(key) + if key is None or name == "topics": self.print_topics() return - name = from_cli(key) if name in self._topics: self.print_commands(name) elif name in self.Command: cmd = self.Command[name] print 'Purpose: %s' % cmd.doc self.Backend.cli.build_parser(cmd).print_help() + elif name == "commands": + mcl = max(len(s) for s in (self.Command)) + for cname in self.Command: + cmd = self.Command[cname] + print '%s %s' % (to_cli(cmd.name).ljust(mcl), cmd.doc) else: raise HelpError(topic=name) |