help, makeapi: allow setting command topic explicitly

Help topic can now be specified in the 'topic' class attribute of command
plugins. Default value is the name of the module where the command is
defined.

This allows defining a command outside of the topic module.

https://fedorahosted.org/freeipa/ticket/4739

Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
Jan Cholasta
2016-05-12 13:41:09 +02:00
parent 327d95296a
commit 0a984afd81
3 changed files with 62 additions and 62 deletions

View File

@@ -427,6 +427,10 @@ class Command(HasParam):
callback_types = ('interactive_prompt',)
@property
def topic(self):
return type(self).__module__.rpartition('.')[2]
def __call__(self, *args, **options):
"""
Perform validation and then execute the command.