mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-09-03 20:52:56 -05:00
263: CLI.print_commands() now seperates Command subclasses from Application subclasses
This commit is contained in:
+17
-7
@@ -99,12 +99,22 @@ class CLI(object):
|
|||||||
api = property(__get_api)
|
api = property(__get_api)
|
||||||
|
|
||||||
def print_commands(self):
|
def print_commands(self):
|
||||||
print 'Available Commands:'
|
std = set(self.api.Command) - set(self.api.Application)
|
||||||
for cmd in self.api.Command():
|
print '\nStandard IPA commands:'
|
||||||
print ' %s %s' % (
|
for key in sorted(std):
|
||||||
to_cli(cmd.name).ljust(self.mcl),
|
cmd = self.api.Command[key]
|
||||||
cmd.doc,
|
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):
|
def __contains__(self, key):
|
||||||
assert self.__d is not None, 'you must call finalize() first'
|
assert self.__d is not None, 'you must call finalize() first'
|
||||||
@@ -134,7 +144,7 @@ class CLI(object):
|
|||||||
self.finalize()
|
self.finalize()
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
self.print_commands()
|
self.print_commands()
|
||||||
print 'Usage: ipa COMMAND [ARGS]'
|
print '\nUsage: ipa COMMAND'
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
key = sys.argv[1]
|
key = sys.argv[1]
|
||||||
if key not in self:
|
if key not in self:
|
||||||
|
|||||||
Reference in New Issue
Block a user