fix: verify prog actually exists before using it

This commit is contained in:
Matthias
2025-12-09 19:34:58 +01:00
parent f0f48395c5
commit 46538d9a5b

View File

@@ -352,7 +352,7 @@ class Arguments:
opt = AVAILABLE_CLI_OPTIONS[val] opt = AVAILABLE_CLI_OPTIONS[val]
options = deepcopy(opt.kwargs) options = deepcopy(opt.kwargs)
help_text = options.pop("help", None) help_text = options.pop("help", None)
if opt.fthelp and isinstance(opt.fthelp, dict): if opt.fthelp and isinstance(opt.fthelp, dict) and hasattr(parser, "prog"):
help_text = opt.fthelp.get(parser.prog, help_text) help_text = opt.fthelp.get(parser.prog, help_text)
parser.add_argument(*opt.cli, dest=val, help=help_text, **options) parser.add_argument(*opt.cli, dest=val, help=help_text, **options)