download: put --config before the subcommand in the VPN-wrapped re-run (fixes argparse unrecognized argument)
This commit is contained in:
@@ -37,10 +37,12 @@ def cmd_init(args: argparse.Namespace) -> int:
|
|||||||
|
|
||||||
def _download_argv(args: argparse.Namespace) -> list[str]:
|
def _download_argv(args: argparse.Namespace) -> list[str]:
|
||||||
"""Rebuild the `download` argv for the VPN-wrapped subprocess."""
|
"""Rebuild the `download` argv for the VPN-wrapped subprocess."""
|
||||||
argv = ["download"]
|
argv = []
|
||||||
if getattr(args, "config", None):
|
if getattr(args, "config", None):
|
||||||
|
# --config is a parent/global option and must come before the
|
||||||
|
# subcommand, or argparse treats it as unrecognized
|
||||||
argv += ["--config", str(args.config)]
|
argv += ["--config", str(args.config)]
|
||||||
argv += [args.url]
|
argv += ["download", args.url]
|
||||||
if getattr(args, "quality", None):
|
if getattr(args, "quality", None):
|
||||||
argv += ["--quality", args.quality]
|
argv += ["--quality", args.quality]
|
||||||
if getattr(args, "format", None):
|
if getattr(args, "format", None):
|
||||||
|
|||||||
Reference in New Issue
Block a user