MCPcopy Index your code
hub / github.com/Breakthrough/PySceneDetect / patch_help

Function patch_help

docs/generate_cli_docs.py:70–87  ·  view source on GitHub ↗
(s: str, commands: list[str])

Source from the content-addressed store, hash-verified

68
69
70def patch_help(s: str, commands: list[str]) -> str:
71 # Patch some TODOs still not handled correctly below.
72 pos = 0
73 while True:
74 pos = s.find("global option :option:", pos)
75 if pos < 0:
76 break
77 pos = s.find("<-", pos)
78 assert pos > 0
79 s = s[: pos + 1] + "scenedetect " + s[pos + 1 :]
80
81 for command in [command for command in commands if command not in INFO_COMMANDS]:
82
83 def add_link(_match: re.Match, command: str = command) -> str:
84 return f":ref:`{command} <command-{command}>`"
85
86 s = re.sub(f"``{command}``(?!\\n)", add_link, s)
87 return s
88
89
90def generate_title(s: str, level: int = 0, len: int = 72) -> StrGenerator:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected