MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / format_option

Function format_option

docs/generate_cli_docs.py:156–179  ·  view source on GitHub ↗
(command: click.Command, opt: click.Option, flags: list[str])

Source from the content-addressed store, hash-verified

154
155
156def format_option(command: click.Command, opt: click.Option, flags: list[str]) -> StrGenerator:
157 if isinstance(opt, click.Argument):
158 yield f"\n.. option:: {opt.name}\n"
159 return
160 yield "\n.. option:: {}\n".format(
161 ", ".join(
162 arg if opt.metavar is None else f"{arg} {opt.metavar}"
163 for arg in sorted(opt.opts, reverse=True)
164 )
165 )
166
167 help = (
168 OPTION_HELP_OVERRIDES[command.name][opt.name]
169 if command.name in OPTION_HELP_OVERRIDES and opt.name in OPTION_HELP_OVERRIDES[command.name]
170 else opt.help.strip()
171 )
172
173 # TODO: Make metavars link to the option as well.
174 help, default = extract_default_value(help)
175 help = transform_add_option_refs(help, flags)
176
177 yield f"\n {help}\n"
178 if default is not None:
179 yield f"\n Default: ``{default}``\n"
180
181
182def generate_command_help(

Callers 1

generate_command_helpFunction · 0.85

Calls 3

extract_default_valueFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected