Skip to content
Snippets Groups Projects
Unverified Commit bf00d509 authored by Andrej Shadura's avatar Andrej Shadura
Browse files

Emulate get_cmd_help missing from osc 1.x

parent 19f09032
No related branches found
No related tags found
No related merge requests found
Pipeline #98134 failed
...@@ -35,4 +35,15 @@ def do_dput(self, subcmd, opts, *args): ...@@ -35,4 +35,15 @@ def do_dput(self, subcmd, opts, *args):
if hasattr(self, "osc_plugin_dput"): if hasattr(self, "osc_plugin_dput"):
osc_plugin_dput = self.osc_plugin_dput # noqa: F811 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) osc_plugin_dput.do_dput(self, subcmd, opts, *args)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment