diff --git a/cement/core/arg.py b/cement/core/arg.py index fc2ed08d..4c116856 100644 --- a/cement/core/arg.py +++ b/cement/core/arg.py @@ -97,7 +97,10 @@ class CementArgumentHandler(handler.CementBaseHandler): """ # pylint: disable=W0232,R0903 class Meta: - """Handler meta-data options.""" + """ + Handler meta-data (can be passed as keyword arguments to the parent + class). + """ label = None """The string identifier of the handler implementation.""" diff --git a/cement/core/cache.py b/cement/core/cache.py index 455bc923..f3005760 100644 --- a/cement/core/cache.py +++ b/cement/core/cache.py @@ -109,7 +109,11 @@ class CementCacheHandler(handler.CementBaseHandler): """ class Meta: - """Handler meta-data.""" + """ + Handler meta-data (can be passed as keyword arguments to the parent + class). + """ + label = None """String identifier of this handler implementation.""" diff --git a/cement/core/config.py b/cement/core/config.py index 2de72372..7543ed83 100644 --- a/cement/core/config.py +++ b/cement/core/config.py @@ -161,6 +161,7 @@ class IConfig(interface.Interface): """ Returns whether or not the section exists. + :param section: The section to test for. :returns: boolean """ @@ -171,7 +172,10 @@ class CementConfigHandler(handler.CementBaseHandler): """ class Meta: - """Handler meta-data.""" + """ + Handler meta-data (can be passed as keyword arguments to the parent + class). + """ label = None """The string identifier of the implementation.""" diff --git a/cement/core/controller.py b/cement/core/controller.py index 73f5fc29..ed1a1316 100644 --- a/cement/core/controller.py +++ b/cement/core/controller.py @@ -62,11 +62,16 @@ class IController(interface.Interface): """ # pylint: disable=W0232, C0111, R0903 class IMeta: + """Interface meta-data.""" + label = 'controller' + """The string identifier of the interface.""" + validator = controller_validator + """The interface validator function.""" # Must be provided by the implementation - Meta = interface.Attribute('Handler Meta-data') + Meta = interface.Attribute('Handler meta-data') def _setup(app_obj): """ @@ -77,12 +82,8 @@ class IController(interface.Interface): Must 'setup' the handler object making it ready for the framework or the application to make further calls to it. - Required Arguments: - - app_obj - The application object. - - Return: None + :param app_obj: The application object. + :returns: None """ @@ -96,7 +97,8 @@ class IController(interface.Interface): on a controller, as it expects the controller to handle parsing arguments (I.e. self.app.args.parse()). - Return None + :returns: None + """ class expose(object): @@ -104,16 +106,12 @@ class expose(object): Used to expose controller functions to be listed as commands, and to decorate the function with Meta data for the argument parser. - Optional Arguments: - - hide - Whether the command should be visible. - - help - Help text to display for that command. - - aliases - List of aliases to this command. + :param hide: Whether the command should be visible. + :type hide: boolean + :param help: Help text to display for that command. + :type help: str + :param aliases: Aliases to this command. + :type aliases: list Usage: @@ -150,59 +148,15 @@ class expose(object): class CementBaseController(handler.CementBaseHandler): """ - This is an implementation of the IControllerHandler interface, but as a - base class that application controllers need to subclass from. + This is an implementation of the + `IControllerHandler <#cement.core.controller.IController>`_ interface, but + as a base class that application controllers `should` subclass from. Registering it directly as a handler is useless. - NOTE: This handler *requires* that the applications 'arg_handler' be + NOTE: This handler **requires** that the applications 'arg_handler' be argparse. If using an alternative argument handler you will need to write your own controller base class. - Optional / Meta Options: - - interface - The interface that this controller implements (IController). - - label - The label of the controller. Will be used as the sub-command - name for 'stacked' controllers. - - aliases - A list of aliases for the controller. Will be treated like - command/function aliases for non-stacked controllers. For example: - 'myapp --help' is the same as - 'myapp --help'. - - Default: [] - - description - The description shown at the top of '--help'. - - config_section - A config [section] to merge config_defaults into. - - Default: controller.