mitmproxy/docs/scripts/options.py
dependabot[bot] 77d1f278e1
Update ruff requirement from <=0.8.6,>=0.5.0 to >=0.5.0,<=0.9.4 (#7528)
* Update ruff requirement from <=0.8.6,>=0.5.0 to >=0.5.0,<=0.9.4

Updates the requirements on [ruff](https://github.com/astral-sh/ruff) to permit the latest version.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.5.0...0.9.4)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* [autofix.ci] apply automated fixes

* fixup

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2025-02-01 23:21:33 +00:00

62 lines
1.6 KiB
Python
Executable file

#!/usr/bin/env python3
import asyncio
from mitmproxy import options
from mitmproxy import optmanager
from mitmproxy.tools import console
from mitmproxy.tools import dump
from mitmproxy.tools import web
masters = {
"mitmproxy": console.master.ConsoleMaster,
"mitmdump": dump.DumpMaster,
"mitmweb": web.master.WebMaster,
}
unified_options = {}
async def dump():
for tool_name, master in masters.items():
opts = options.Options()
_ = master(opts)
for key, option in optmanager.dump_dicts(opts).items():
if key in unified_options:
unified_options[key]["tools"].append(tool_name)
else:
unified_options[key] = option
unified_options[key]["tools"] = [tool_name]
asyncio.run(dump())
print(
"""
<table class=\"table optiontable\">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
""".strip()
)
for key, option in sorted(unified_options.items(), key=lambda t: t[0]):
print(
f"""
<tr id="{key}">
<th>
<a class="anchor" href="#{key}">#&nbsp;&nbsp;</a>
{key}<br/>
{" ".join(["<span class='badge'>{}</span>".format(t) for t in option["tools"]])}</th>
<td>{option["type"]}</td>
<td>{option["help"]}<br/>
Default: {option["default"]}
{"<br/>Choices: {}".format(", ".join(option["choices"])) if option["choices"] else ""}
</td>
</tr>
""".strip()
)
print("</tbody></table>")