diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-04 09:04:35 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-04 09:04:35 +0000 |
commit | 6b9ba734e119cbdc92ebc0a1b28d75b405d46bb0 (patch) | |
tree | 66430e74c9feb4fbf249d6f999a3328ac55ae5ce /ipalib/cli.py | |
parent | 86035c865514b1f1022bfe68813729ea08439de4 (diff) | |
download | freeipa-6b9ba734e119cbdc92ebc0a1b28d75b405d46bb0.tar.gz freeipa-6b9ba734e119cbdc92ebc0a1b28d75b405d46bb0.tar.xz freeipa-6b9ba734e119cbdc92ebc0a1b28d75b405d46bb0.zip |
263: CLI.print_commands() now seperates Command subclasses from Application subclasses
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r-- | ipalib/cli.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index abaef0308..7ab0ae8db 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -99,12 +99,22 @@ class CLI(object): api = property(__get_api) def print_commands(self): - print 'Available Commands:' - for cmd in self.api.Command(): - print ' %s %s' % ( - to_cli(cmd.name).ljust(self.mcl), - cmd.doc, - ) + std = set(self.api.Command) - set(self.api.Application) + print '\nStandard IPA commands:' + for key in sorted(std): + cmd = self.api.Command[key] + self.print_cmd(cmd) + print '\nSpecial CLI commands:' + for cmd in self.api.Application(): + self.print_cmd(cmd) + + def print_cmd(self, cmd): + print ' %s %s' % ( + to_cli(cmd.name).ljust(self.mcl), + cmd.doc, + ) + + def __contains__(self, key): assert self.__d is not None, 'you must call finalize() first' @@ -134,7 +144,7 @@ class CLI(object): self.finalize() if len(sys.argv) < 2: self.print_commands() - print 'Usage: ipa COMMAND [ARGS]' + print '\nUsage: ipa COMMAND' sys.exit(2) key = sys.argv[1] if key not in self: |