-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgendocs.py
34 lines (25 loc) · 894 Bytes
/
gendocs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import click
from r2e.cli import r2e # Import your main CLI group
def generate_docs():
output = "# R2E CLI Documentation\n\n"
# Generate Table of Contents
output += "## Summary:\n\n"
for command in r2e.commands.values():
output += (
f"- [r2e {command.name}](#r2e-{command.name.lower()}): {command.help}\n"
)
output += "\n"
for command in r2e.commands.values():
output += f"## `r2e {command.name}`\n\n"
output += f"{command.help}\n\n"
output += "### Options:\n\n"
for param in command.params:
output += f"- `--{param.name}`: {param.help}"
if param.default:
output += f" (default: {param.default})"
output += "\n"
output += "\n"
with open("./docs/CLI.md", "w") as f:
f.write(output)
if __name__ == "__main__":
generate_docs()