mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Merge pull request #4309 from jrblixt/InformUnderscoreFormat-Issue_4054
Inform user when underscore-formatted options are used.
This commit is contained in:
commit
b01d574d8b
@ -9,6 +9,7 @@ Unreleased: mitmproxy next
|
||||
* Deprecation of pathod and pathoc tools and modules. Future releases might not contain them! (@Kriechi)
|
||||
* Addon to suppress unwanted error messages sent by mitmproxy. (@anneborcherding)
|
||||
* Updated imports and styles for web scanner helper addons. (@anneborcherding)
|
||||
* Inform when underscore-formatted options are used in client arg. (@jrblixt)
|
||||
|
||||
* --- TODO: add new PRs above this line ---
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import sys
|
||||
import re
|
||||
|
||||
DEPRECATED = """
|
||||
--confdir
|
||||
@ -153,3 +154,12 @@ def check():
|
||||
REPLACEMENTS.get(option, None) or option.lstrip("-").replace("-", "_")
|
||||
)
|
||||
)
|
||||
|
||||
# Check for underscores in the options. Options always follow '--'.
|
||||
for argument in args:
|
||||
underscoreParam = re.search('[-]{2}((.*?_)(.*?(\s|$)))+', argument)
|
||||
if underscoreParam is not None:
|
||||
print("{} uses underscores, please use hyphens {}".format(
|
||||
argument,
|
||||
argument.replace('_', '-'))
|
||||
)
|
||||
|
@ -26,7 +26,8 @@ from mitmproxy.utils import arg_check
|
||||
'"ldap[s]:url_server_ldap:dn_auth:password:dn_subtree" '
|
||||
'for LDAP authentication.'),
|
||||
(["--replacements"], "--replacements is deprecated.\n"
|
||||
"Please use `--modify-body` or `--modify-headers` instead.")
|
||||
"Please use `--modify-body` or `--modify-headers` instead."),
|
||||
(["--underscore_option"], "--underscore_option uses underscores, please use hyphens --underscore-option")
|
||||
])
|
||||
def test_check_args(arg, output):
|
||||
f = io.StringIO()
|
||||
|
Loading…
Reference in New Issue
Block a user