Sort arguments lexicographically in command's help (#27196)

This commit is contained in:
Massimiliano Culpo 2021-11-04 20:41:58 +01:00 committed by GitHub
parent 084ce46107
commit 79f754a968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@
import argparse
import inspect
import operator
import os
import os.path
import pstats
@ -188,6 +189,10 @@ def _format_actions_usage(self, actions, groups):
usage = '[-%s] %s' % (chars, usage)
return usage.strip()
def add_arguments(self, actions):
actions = sorted(actions, key=operator.attrgetter('option_strings'))
super(SpackHelpFormatter, self).add_arguments(actions)
class SpackArgumentParser(argparse.ArgumentParser):
def format_help_sections(self, level):