From e46fd3401e01347765c641e3bc4bc7b63f7c7f23 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 12 Jun 2009 13:26:15 -0400 Subject: 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 --- ipalib/cli.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ipalib/cli.py') diff --git a/ipalib/cli.py b/ipalib/cli.py index b7f840cf..6dc0c068 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) -- cgit