Shift option help styling admonition into the appropriate Loader docstring

This commit is contained in:
Aldo Cortesi 2018-02-26 08:10:45 +13:00
parent b57f551c0d
commit 77e5d823e0
2 changed files with 8 additions and 7 deletions

View File

@ -92,6 +92,13 @@ class Loader:
help: str, help: str,
choices: typing.Optional[typing.Sequence[str]] = None choices: typing.Optional[typing.Sequence[str]] = None
) -> None: ) -> None:
"""
Add an option to mitmproxy.
Help should be a single paragraph with no linebreaks - it will be
reflowed by tools. Information on the data type should be omitted -
it will be generated and added by tools as needed.
"""
if name in self.master.options: if name in self.master.options:
existing = self.master.options._options[name] existing = self.master.options._options[name]
same_signature = ( same_signature = (

View File

@ -14,12 +14,6 @@ log_verbosity = [
CA_DIR = "~/.mitmproxy" CA_DIR = "~/.mitmproxy"
LISTEN_PORT = 8080 LISTEN_PORT = 8080
# Some help text style guidelines:
#
# - Should be a single paragraph with no linebreaks. Help will be reflowed by
# tools.
# - Avoid adding information about the data type - we can generate that.
class Options(optmanager.OptManager): class Options(optmanager.OptManager):
@ -42,6 +36,7 @@ class Options(optmanager.OptManager):
mode = None # type: str mode = None # type: str
rawtcp = None # type: bool rawtcp = None # type: bool
server = None # type: bool server = None # type: bool
showhost = None # type: bool
spoof_source_address = None # type: bool spoof_source_address = None # type: bool
ssl_insecure = None # type: bool ssl_insecure = None # type: bool
ssl_verify_upstream_trusted_ca = None # type: Optional[str] ssl_verify_upstream_trusted_ca = None # type: Optional[str]
@ -56,7 +51,6 @@ class Options(optmanager.OptManager):
# FIXME: Options that must be migrated to addons, but are complicated # FIXME: Options that must be migrated to addons, but are complicated
# because they're used by more than one addon, or because they're # because they're used by more than one addon, or because they're
# embedded in the core code somehow. # embedded in the core code somehow.
showhost = None # type: bool
verbosity = None # type: str verbosity = None # type: str
view_filter = None # type: Optional[str] view_filter = None # type: Optional[str]