Add autoprogram_cliff_app_dist_name config opt
This allows consumers to let cliff know who they are, so the autoprogram-sphinx directive doesn't produce messages like This command is provided by the $me plugin. Change-Id: I2d5a527910ddc64f83d0cba39c584b8b05a299b7
This commit is contained in:
parent
9c561ef6c3
commit
8e4ae2b86c
|
@ -137,8 +137,10 @@ class Command(object):
|
||||||
(h.obj.get_epilog() for h in self._hooks),
|
(h.obj.get_epilog() for h in self._hooks),
|
||||||
)
|
)
|
||||||
parts.extend(hook_epilogs)
|
parts.extend(hook_epilogs)
|
||||||
app_dist_name = _get_distribution_for_module(
|
app_dist_name = getattr(
|
||||||
inspect.getmodule(self.app)
|
self, 'app_dist_name', _get_distribution_for_module(
|
||||||
|
inspect.getmodule(self.app)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
dist_name = _get_distribution_for_module(inspect.getmodule(self))
|
dist_name = _get_distribution_for_module(inspect.getmodule(self))
|
||||||
if dist_name and dist_name != app_dist_name:
|
if dist_name and dist_name != app_dist_name:
|
||||||
|
|
|
@ -322,6 +322,9 @@ class AutoprogramCliffDirective(rst.Directive):
|
||||||
:returns: A list of nested docutil nodes
|
:returns: A list of nested docutil nodes
|
||||||
"""
|
"""
|
||||||
command = command_class(None, None)
|
command = command_class(None, None)
|
||||||
|
if not getattr(command, 'app_dist_name', None):
|
||||||
|
command.app_dist_name = (
|
||||||
|
self.env.config.autoprogram_cliff_app_dist_name)
|
||||||
parser = command.get_parser(command_name)
|
parser = command.get_parser(command_name)
|
||||||
ignored_opts = ignored_opts or []
|
ignored_opts = ignored_opts or []
|
||||||
|
|
||||||
|
@ -375,3 +378,4 @@ def setup(app):
|
||||||
app.add_directive('autoprogram-cliff', AutoprogramCliffDirective)
|
app.add_directive('autoprogram-cliff', AutoprogramCliffDirective)
|
||||||
app.add_config_value('autoprogram_cliff_application', '', True)
|
app.add_config_value('autoprogram_cliff_application', '', True)
|
||||||
app.add_config_value('autoprogram_cliff_ignored', ['--help'], True)
|
app.add_config_value('autoprogram_cliff_ignored', ['--help'], True)
|
||||||
|
app.add_config_value('autoprogram_cliff_app_dist_name', None, True)
|
||||||
|
|
|
@ -125,6 +125,14 @@ Directive
|
||||||
|
|
||||||
.. seealso:: The ``:ignored:`` directive option.
|
.. seealso:: The ``:ignored:`` directive option.
|
||||||
|
|
||||||
|
`autoprogram_cliff_app_dist_name`
|
||||||
|
The name of the python distribution (the name used with pip, as opposed to
|
||||||
|
the package name used for importing) providing the commands/applications
|
||||||
|
being documented. Generated documentation for plugin components includes
|
||||||
|
a message indicating the name of the plugin. Setting this option tells
|
||||||
|
cliff the name of the distribution providing components natively so their
|
||||||
|
documentation does not include this message.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
Module `sphinxcontrib.autoprogram`
|
Module `sphinxcontrib.autoprogram`
|
||||||
|
|
Loading…
Reference in New Issue