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):