re-categorize some command-line options in --help

This commit is contained in:
Mike Fährmann
2024-06-15 23:29:09 +02:00
parent ae3706286a
commit 76385f5f18
2 changed files with 98 additions and 88 deletions

View File

@@ -173,28 +173,6 @@ def build_parser():
action="version", version=version.__version__,
help="Print program version and exit",
)
if util.EXECUTABLE:
general.add_argument(
"-U", "--update",
dest="update", action="store_const", const="latest",
help="Update to the latest version",
)
general.add_argument(
"--update-to",
dest="update", metavar="[CHANNEL@]TAG",
help="Upgrade/downgrade to a specific version",
)
general.add_argument(
"--update-check",
dest="update", action="store_const", const="check",
help="Check if a newer version is available",
)
else:
general.add_argument(
"-U", "--update-check",
dest="update", action="store_const", const="check",
help="Check if a newer version is available",
)
general.add_argument(
"-f", "--filename",
dest="filename", metavar="FORMAT",
@@ -216,16 +194,6 @@ def build_parser():
dest="extractor_sources", metavar="PATH", action="append",
help="Load external extractors from PATH",
)
general.add_argument(
"--proxy",
dest="proxy", metavar="URL", action=ConfigAction,
help="Use the specified proxy",
)
general.add_argument(
"--source-address",
dest="source-address", metavar="IP", action=ConfigAction,
help="Client-side IP address to bind to",
)
general.add_argument(
"--user-agent",
dest="user-agent", metavar="UA", action=ConfigAction,
@@ -238,6 +206,31 @@ def build_parser():
"(ALL to delete everything)",
)
update = parser.add_argument_group("Update Options")
if util.EXECUTABLE or 1:
update.add_argument(
"-U", "--update",
dest="update", action="store_const", const="latest",
help="Update to the latest version",
)
update.add_argument(
"--update-to",
dest="update", metavar="CHANNEL[@TAG]",
help=("Switch to a dfferent release channel (stable or dev) "
"or upgrade/downgrade to a specific version"),
)
update.add_argument(
"--update-check",
dest="update", action="store_const", const="check",
help="Check if a newer version is available",
)
else:
update.add_argument(
"-U", "--update-check",
dest="update", action="store_const", const="check",
help="Check if a newer version is available",
)
input = parser.add_argument_group("Input Options")
input.add_argument(
"urls",
@@ -353,6 +346,34 @@ def build_parser():
help=("Do not emit ANSI color codes in output"),
)
networking = parser.add_argument_group("Networking Options")
networking.add_argument(
"-R", "--retries",
dest="retries", metavar="N", type=int, action=ConfigAction,
help=("Maximum number of retries for failed HTTP requests "
"or -1 for infinite retries (default: 4)"),
)
networking.add_argument(
"--http-timeout",
dest="timeout", metavar="SECONDS", type=float, action=ConfigAction,
help="Timeout for HTTP connections (default: 30.0)",
)
networking.add_argument(
"--proxy",
dest="proxy", metavar="URL", action=ConfigAction,
help="Use the specified proxy",
)
networking.add_argument(
"--source-address",
dest="source-address", metavar="IP", action=ConfigAction,
help="Client-side IP address to bind to",
)
networking.add_argument(
"--no-check-certificate",
dest="verify", nargs=0, action=ConfigConstAction, const=False,
help="Disable HTTPS certificate validation",
)
downloader = parser.add_argument_group("Downloader Options")
downloader.add_argument(
"-r", "--limit-rate",
@@ -360,15 +381,9 @@ def build_parser():
help="Maximum download rate (e.g. 500k or 2.5M)",
)
downloader.add_argument(
"-R", "--retries",
dest="retries", metavar="N", type=int, action=ConfigAction,
help=("Maximum number of retries for failed HTTP requests "
"or -1 for infinite retries (default: 4)"),
)
downloader.add_argument(
"--http-timeout",
dest="timeout", metavar="SECONDS", type=float, action=ConfigAction,
help="Timeout for HTTP connections (default: 30.0)",
"--chunk-size",
dest="chunk-size", metavar="SIZE", action=ConfigAction,
help="Size of in-memory data chunks (default: 32k)",
)
downloader.add_argument(
"--sleep",
@@ -389,21 +404,6 @@ def build_parser():
help=("Number of seconds to wait before starting data extraction "
"for an input URL"),
)
downloader.add_argument(
"--filesize-min",
dest="filesize-min", metavar="SIZE", action=ConfigAction,
help="Do not download files smaller than SIZE (e.g. 500k or 2.5M)",
)
downloader.add_argument(
"--filesize-max",
dest="filesize-max", metavar="SIZE", action=ConfigAction,
help="Do not download files larger than SIZE (e.g. 500k or 2.5M)",
)
downloader.add_argument(
"--chunk-size",
dest="chunk-size", metavar="SIZE", action=ConfigAction,
help="Size of in-memory data chunks (default: 32k)",
)
downloader.add_argument(
"--no-part",
dest="part", nargs=0, action=ConfigConstAction, const=False,
@@ -425,16 +425,6 @@ def build_parser():
dest="download", nargs=0, action=ConfigConstAction, const=False,
help=("Do not download any files")
)
downloader.add_argument(
"--no-postprocessors",
dest="postprocess", nargs=0, action=ConfigConstAction, const=False,
help=("Do not run any post processors")
)
downloader.add_argument(
"--no-check-certificate",
dest="verify", nargs=0, action=ConfigConstAction, const=False,
help="Disable HTTPS certificate validation",
)
configuration = parser.add_argument_group("Configuration Options")
configuration.add_argument(
@@ -525,12 +515,6 @@ def build_parser():
)
selection = parser.add_argument_group("Selection Options")
selection.add_argument(
"--download-archive",
dest="archive", metavar="FILE", action=ConfigAction,
help=("Record all downloaded or skipped files in FILE and "
"skip downloading any file already in it"),
)
selection.add_argument(
"-A", "--abort",
dest="abort", metavar="N", type=int,
@@ -543,6 +527,22 @@ def build_parser():
help=("Stop current and parent extractor runs "
"after N consecutive file downloads were skipped"),
)
selection.add_argument(
"--filesize-min",
dest="filesize-min", metavar="SIZE", action=ConfigAction,
help="Do not download files smaller than SIZE (e.g. 500k or 2.5M)",
)
selection.add_argument(
"--filesize-max",
dest="filesize-max", metavar="SIZE", action=ConfigAction,
help="Do not download files larger than SIZE (e.g. 500k or 2.5M)",
)
selection.add_argument(
"--download-archive",
dest="archive", metavar="FILE", action=ConfigAction,
help=("Record all downloaded or skipped files in FILE and "
"skip downloading any file already in it"),
)
selection.add_argument(
"--range",
dest="image-range", metavar="RANGE", action=ConfigAction,
@@ -583,6 +583,11 @@ def build_parser():
dest="postprocessors", metavar="NAME", action="append", default=[],
help="Activate the specified post processor",
)
postprocessor.add_argument(
"--no-postprocessors",
dest="postprocess", nargs=0, action=ConfigConstAction, const=False,
help=("Do not run any post processors")
)
postprocessor.add_argument(
"-O", "--postprocessor-option",
dest="options_pp", metavar="KEY=VALUE",