From bf00d509c316660a1ef0b451291ab7c207950f6b Mon Sep 17 00:00:00 2001 From: Andrej Shadura <andrew.shadura@collabora.co.uk> Date: Fri, 7 Jun 2024 14:01:38 +0200 Subject: [PATCH] Emulate get_cmd_help missing from osc 1.x Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk> --- dput.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dput.py b/dput.py index 1d594fe..e97f9f9 100644 --- a/dput.py +++ b/dput.py @@ -35,4 +35,15 @@ def do_dput(self, subcmd, opts, *args): if hasattr(self, "osc_plugin_dput"): osc_plugin_dput = self.osc_plugin_dput # noqa: F811 + # osc 1.x removes get_cmd_help, inject a replacement + if not hasattr(self, "get_cmd_help"): + def format_help(subcmd, opts=None, *args): + for action in self.argparser._actions: + if not isinstance(action, argparse._SubParsersAction): + continue + for choice, subparser in action.choices.items(): + if choice == subcmd: + return subparser.format_help() + self.get_cmd_help = format_help + osc_plugin_dput.do_dput(self, subcmd, opts, *args) -- GitLab