cli.argparser: metadata availability in plugins

This commit is contained in:
bastimeyer 2023-08-26 00:28:19 +02:00 committed by Sebastian Meyer
parent b547fe41b5
commit 1b57d51435
2 changed files with 16 additions and 7 deletions

View File

@ -25,7 +25,6 @@ _option_line_re = re.compile(r"^(?!\s{2,}%\(prog\)s|\s{2,}--\w[\w-]*\w\b|Example
_option_re = re.compile(r"(?:^|(?<=\s))(?P<arg>--\w[\w-]*\w)(?P<val>=\w+)?\b")
_prog_re = re.compile(r"%\(prog\)s")
_percent_re = re.compile(r"%%")
_cli_metadata_variables_section_cross_link_re = re.compile(r"the \"Metadata variables\" section")
_inline_code_block_re = re.compile(r"(?<!`)`([^`]+?)`")
_example_inline_code_block_re = re.compile(r"(?<=^Example: )(.+)$", re.MULTILINE)
@ -92,11 +91,17 @@ class ArgparseDirective(Directive):
# fix escaped chars for percent-formatted argparse help strings
helptext = _percent_re.sub("%", helptext)
# create cross-link for the "Metadata variables" section
helptext = _cli_metadata_variables_section_cross_link_re.sub(
# create cross-links for the "Metadata variables" and "Plugins" sections
helptext = re.sub(
r"the \"Metadata variables\" section",
"the \":ref:`Metadata variables <cli/metadata:Variables>`\" section",
helptext,
)
helptext = re.sub(
r"the \"Plugins\" section",
"the \":ref:`Plugins <plugins:Plugins>`\" section",
helptext,
)
return indent(helptext)

View File

@ -553,7 +553,8 @@ def build_parser():
help=f"""
Change the title of the video player's window.
Please see the "Metadata variables" section of Streamlink's CLI documentation for all available metadata variables.
Please see the "Metadata variables" section of Streamlink's CLI documentation for all available metadata variables,
as well as the "Plugins" section for the list of metadata variables defined in each plugin.
This option is only supported for the following players: {', '.join(sorted(PlayerOutput.PLAYERS.keys()))}
@ -585,7 +586,8 @@ def build_parser():
You will be prompted if the file already exists.
Please see the "Metadata variables" section of Streamlink's CLI documentation for all available metadata variables.
Please see the "Metadata variables" section of Streamlink's CLI documentation for all available metadata variables,
as well as the "Plugins" section for the list of metadata variables defined in each plugin.
Unsupported characters in substituted variables will be replaced with an underscore.
@ -612,7 +614,8 @@ def build_parser():
You will be prompted if the file already exists.
Please see the "Metadata variables" section of Streamlink's CLI documentation for all available metadata variables.
Please see the "Metadata variables" section of Streamlink's CLI documentation for all available metadata variables,
as well as the "Plugins" section for the list of metadata variables defined in each plugin.
Unsupported characters in substituted variables will be replaced with an underscore.
@ -631,7 +634,8 @@ def build_parser():
You will be prompted if the file already exists.
Please see the "Metadata variables" section of Streamlink's CLI documentation for all available metadata variables.
Please see the "Metadata variables" section of Streamlink's CLI documentation for all available metadata variables,
as well as the "Plugins" section for the list of metadata variables defined in each plugin.
Unsupported characters in substituted variables will be replaced with an underscore.