summaryrefslogtreecommitdiff
path: root/docs/source
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-07-09 20:09:23 +0000
committerIan Cordasco <graffatcolmingov@gmail.com>2016-07-09 20:09:23 +0000
commitf93a3f3c7ba95863a36626f698fcb615763ec0f8 (patch)
tree972a24a1fdd57443d3457b47e1b8ec79958c7bb5 /docs/source
parent45a57df5421c2e615888a70eae2783d3d075bf21 (diff)
parentfabb13c5d1577fd965a78d30143accabf3213256 (diff)
downloadflake8-f93a3f3c7ba95863a36626f698fcb615763ec0f8.tar.gz
Merge branch 'get-option' into 'master'
Use option name provided by the parser Use the `Option` object returned to get the actual name. *Related to:* #158 See merge request !68
Diffstat (limited to 'docs/source')
-rw-r--r--docs/source/plugin-development/cross-compatibility.rst8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/source/plugin-development/cross-compatibility.rst b/docs/source/plugin-development/cross-compatibility.rst
index ed8762f..e1c7cf6 100644
--- a/docs/source/plugin-development/cross-compatibility.rst
+++ b/docs/source/plugin-development/cross-compatibility.rst
@@ -120,9 +120,9 @@ options with |Flake8| and have it work on |Flake8| 2.x and 3.x.
except (optparse.OptionError, TypeError):
# Flake8 2.x registration
parse_from_config = option_kwargs.pop('parse_from_config', False)
- parser.add_option(*option_args, **option_kwargs)
+ option = parser.add_option(*option_args, **option_kwargs)
if parse_from_config:
- parser.config_options.append(option_args[-1].lstrip('-'))
+ parser.config_options.append(option.get_opt_string().lstrip('-'))
Or, you can write a tiny helper function:
@@ -140,9 +140,9 @@ Or, you can write a tiny helper function:
parse_from_config = kwargs.pop('parse_from_config', False)
kwargs.pop('comma_separated_list', False)
kwargs.pop('normalize_paths', False)
- parser.add_option(*args, **kwargs)
+ option = parser.add_option(*args, **kwargs)
if parse_from_config:
- parser.config_options.append(args[-1].lstrip('-'))
+ parser.config_options.append(option.get_opt_string().lstrip('-'))
.. code-block:: python