1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-24 22:06:14 +01:00

cmdln: Sort commands before printing help

This commit is contained in:
Daniel Mach 2023-03-28 14:36:56 +02:00
parent f7c84d42a3
commit e0404c003b

View File

@ -81,7 +81,9 @@ class HelpFormatter(argparse.RawDescriptionHelpFormatter):
def _format_action(self, action):
if isinstance(action, argparse._SubParsersAction):
parts = []
for i in action._get_subactions():
subactions = action._get_subactions()
subactions.sort(key=lambda x: x.metavar)
for i in subactions:
if i.help == argparse.SUPPRESS:
# don't display commands with suppressed help
continue