mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-26 06:46:13 +01:00
cmdln: Sort commands before printing help
This commit is contained in:
parent
f7c84d42a3
commit
e0404c003b
@ -81,7 +81,9 @@ class HelpFormatter(argparse.RawDescriptionHelpFormatter):
|
|||||||
def _format_action(self, action):
|
def _format_action(self, action):
|
||||||
if isinstance(action, argparse._SubParsersAction):
|
if isinstance(action, argparse._SubParsersAction):
|
||||||
parts = []
|
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:
|
if i.help == argparse.SUPPRESS:
|
||||||
# don't display commands with suppressed help
|
# don't display commands with suppressed help
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user