diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-05-17 20:19:02 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-05-17 20:19:02 -0500 |
| commit | 36bb148ad542b99816de771739f6d2ad25343245 (patch) | |
| tree | 75b855ba87b22fd2a42be06e47be7a6343630bd2 /docs/source | |
| parent | 9ada68118dca394441c2ba0a6bd94ce3ab898d45 (diff) | |
| download | flake8-36bb148ad542b99816de771739f6d2ad25343245.tar.gz | |
Add documentation for receiving parsed options
Diffstat (limited to 'docs/source')
| -rw-r--r-- | docs/source/dev/plugin_parameters.rst | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/source/dev/plugin_parameters.rst b/docs/source/dev/plugin_parameters.rst index 17a4dd3..39db95e 100644 --- a/docs/source/dev/plugin_parameters.rst +++ b/docs/source/dev/plugin_parameters.rst @@ -137,6 +137,25 @@ For information about other parameters to :meth:`~flake8.options.manager.OptionManager.add_option` refer to the documentation of :mod:`optparse`. + +Accessing Parsed Options +======================== + +When a plugin has a callable ``provide_options`` attribute, Flake8 will call +it and attempt to provide the |OptionManager| instance, the parsed options +which will be an instance of :class:`optparse.Values`, and the extra arguments +that were not parsed by the |OptionManager|. If that fails, we will just pass +the :class:`optparse.Values`. In other words, your ``provide_options`` +callable will have one of the following signatures: + +.. code-block:: python + + def provide_options(option_manager, options, args): + pass + # or + def provide_options(options): + pass + .. substitutions .. |OptionManager| replace:: :class:`~flake8.options.manager.OptionManager` .. |Option| replace:: :class:`~flake8.options.manager.Option` |
