mirror of https://github.com/pwndbg/pwndbg.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
975 B
Python
37 lines
975 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
import re
|
|
from dataclasses import dataclass
|
|
from typing import Tuple
|
|
|
|
BASE_PATH = os.path.join("docs", "commands")
|
|
|
|
|
|
@dataclass
|
|
class ExtractedCommand:
|
|
name: str
|
|
category: str
|
|
filename: str
|
|
description: str
|
|
aliases: list[str]
|
|
examples: str
|
|
notes: str
|
|
pure_epilog: str
|
|
usage: str
|
|
positionals: list[Tuple[str, str]]
|
|
optionals: list[Tuple[str, str, str]]
|
|
|
|
|
|
def category_to_folder_name(category) -> str:
|
|
folder = category.lower()
|
|
folder = re.sub(r"[ /]", "_", folder) # replace all spaces and / with _
|
|
# Don't allow wacky characters for folder names. If you hit this assert, feel free
|
|
# to update the regex above to sanitize the category name.
|
|
assert all(c.isalnum() or c in ("_", "-") for c in folder), f"Error folder={folder}"
|
|
return folder
|
|
|
|
|
|
def extracted_filename(debugger: str) -> str:
|
|
return os.path.join("scripts", "_docs", debugger + "_commands.json")
|