refactor: improve partials script

This commit is contained in:
Matthias
2025-11-09 08:37:39 +01:00
parent 777ff1938e
commit d246933c28
+53 -50
View File
@@ -2,59 +2,62 @@ import subprocess # noqa: S404, RUF100
from pathlib import Path from pathlib import Path
subcommands = [ def extract_command_partials():
"trade", subcommands = [
"create-userdir", "trade",
"new-config", "create-userdir",
"show-config", "new-config",
"new-strategy", "show-config",
"download-data", "new-strategy",
"convert-data", "download-data",
"convert-trade-data", "convert-data",
"trades-to-ohlcv", "convert-trade-data",
"list-data", "trades-to-ohlcv",
"backtesting", "list-data",
"backtesting-show", "backtesting",
"backtesting-analysis", "backtesting-show",
"edge", "backtesting-analysis",
"hyperopt", "edge",
"hyperopt-list", "hyperopt",
"hyperopt-show", "hyperopt-list",
"list-exchanges", "hyperopt-show",
"list-markets", "list-exchanges",
"list-pairs", "list-markets",
"list-strategies", "list-pairs",
"list-hyperoptloss", "list-strategies",
"list-freqaimodels", "list-hyperoptloss",
"list-timeframes", "list-freqaimodels",
"show-trades", "list-timeframes",
"test-pairlist", "show-trades",
"convert-db", "test-pairlist",
"install-ui", "convert-db",
"plot-dataframe", "install-ui",
"plot-profit", "plot-dataframe",
"webserver", "plot-profit",
"strategy-updater", "webserver",
"lookahead-analysis", "strategy-updater",
"recursive-analysis", "lookahead-analysis",
] "recursive-analysis",
]
result = subprocess.run(["freqtrade", "--help"], capture_output=True, text=True) result = subprocess.run(["freqtrade", "--help"], capture_output=True, text=True)
with Path("docs/commands/main.md").open("w") as f: with Path("docs/commands/main.md").open("w") as f:
f.write(f"```\n{result.stdout}\n```\n")
for command in subcommands:
print(f"Running for {command}")
result = subprocess.run(["freqtrade", command, "--help"], capture_output=True, text=True)
with Path(f"docs/commands/{command}.md").open("w") as f:
f.write(f"```\n{result.stdout}\n```\n") f.write(f"```\n{result.stdout}\n```\n")
for command in subcommands:
print(f"Running for {command}")
result = subprocess.run(["freqtrade", command, "--help"], capture_output=True, text=True)
print("Running for freqtrade-client") with Path(f"docs/commands/{command}.md").open("w") as f:
result_client = subprocess.run(["freqtrade-client", "--show"], capture_output=True, text=True) f.write(f"```\n{result.stdout}\n```\n")
with Path("docs/commands/freqtrade-client.md").open("w") as f: print("Running for freqtrade-client")
f.write(f"```\n{result_client.stdout}\n```\n") result_client = subprocess.run(["freqtrade-client", "--show"], capture_output=True, text=True)
with Path("docs/commands/freqtrade-client.md").open("w") as f:
f.write(f"```\n{result_client.stdout}\n```\n")
if __name__ == "__main__":
extract_command_partials()