From b5d56d4d3498659b888458108f0147509e096973 Mon Sep 17 00:00:00 2001 From: Konstantin Passig PC <2002erdi@gmail.com> Date: Tue, 25 Aug 2026 16:52:43 +0200 Subject: [PATCH] download: put --config before the subcommand in the VPN-wrapped re-run (fixes argparse unrecognized argument) --- yt_downloader/cli.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yt_downloader/cli.py b/yt_downloader/cli.py index a800bae..c5f8ac9 100644 --- a/yt_downloader/cli.py +++ b/yt_downloader/cli.py @@ -37,10 +37,12 @@ def cmd_init(args: argparse.Namespace) -> int: def _download_argv(args: argparse.Namespace) -> list[str]: """Rebuild the `download` argv for the VPN-wrapped subprocess.""" - argv = ["download"] + argv = [] 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 += [args.url] + argv += ["download", args.url] if getattr(args, "quality", None): argv += ["--quality", args.quality] if getattr(args, "format", None):