From cd6d6ea8bea9f58c06b3b806ff495f86b97dccbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 11 Nov 2024 19:07:37 +0100 Subject: [PATCH] [options] fix passing negative numbers as arguments (#5262) https://github.com/mikf/gallery-dl/issues/5262#issuecomment-2468677453 fixes regression introduced in 9e729681 'argparse' sets a flag and changes its behavior when using something that looks like a negative number as option string, '-4' and '-6' in this case. --- gallery_dl/option.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gallery_dl/option.py b/gallery_dl/option.py index 1d94aab9..a3f78e5b 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -803,4 +803,10 @@ def build_parser(): "&& convert * ../doc.pdf\""), ) + try: + # restore normal behavior when adding '-4' or '-6' as arguments + parser._has_negative_number_optionals.clear() + except Exception: + pass + return parser