diff --git a/cliff/sphinxext.py b/cliff/sphinxext.py index 94fe0e3..16915fa 100644 --- a/cliff/sphinxext.py +++ b/cliff/sphinxext.py @@ -204,6 +204,7 @@ class AutoprogramCliffDirective(rst.Directive): option_spec = { 'command': directives.unchanged, 'ignored': directives.unchanged, + 'application': directives.unchanged, } def _load_command(self, manager, command_name): @@ -267,7 +268,8 @@ class AutoprogramCliffDirective(rst.Directive): self.env = self.state.document.settings.env command_pattern = self.options.get('command') - application_name = self.env.config.autoprogram_cliff_application + application_name = (self.options.get('application') + or self.env.config.autoprogram_cliff_application) global_ignored = self.env.config.autoprogram_cliff_ignored local_ignored = self.options.get('ignored', '') diff --git a/doc/source/user/sphinxext.rst b/doc/source/user/sphinxext.rst index d4b5e7a..a05ad93 100644 --- a/doc/source/user/sphinxext.rst +++ b/doc/source/user/sphinxext.rst @@ -29,6 +29,14 @@ cliff supports integration with Sphinx by way of a `Sphinx directives`__. wildcarding is supported. Refer to the example_ below for more information. + `:application:` + + The top-level application name, which will be prefixed before all + commands. This option overrides the global option + `autoprogram_cliff_application` described below. + In most cases the global configuration is enough, but this option is + useful if your sphinx document handles multiple cliff applications. + .. seealso:: The ``autoprogram_cliff_application`` configuration option. `:ignored:` @@ -44,7 +52,7 @@ cliff supports integration with Sphinx by way of a `Sphinx directives`__. `autoprogram_cliff_application` The top-level application name, which will be prefixed before all - commands. This is generally defined in the `console_scripts` attribute of + commands. This is generally defined in the `console_scripts` attribute of the `entry_points` section of either `setup.cfg` or `setup.py`. Refer to the example_ below for more information. @@ -57,6 +65,7 @@ cliff supports integration with Sphinx by way of a `Sphinx directives`__. Defaults to ``''`` .. seealso:: The ``:command:`` directive option. + .. seealso:: The ``:application:`` directive option. `autoprogram_cliff_ignored`