Sort arguments lexicographically in command's help (#27196)
This commit is contained in:
parent
084ce46107
commit
79f754a968
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import inspect
|
import inspect
|
||||||
|
import operator
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import pstats
|
import pstats
|
||||||
@ -188,6 +189,10 @@ def _format_actions_usage(self, actions, groups):
|
|||||||
usage = '[-%s] %s' % (chars, usage)
|
usage = '[-%s] %s' % (chars, usage)
|
||||||
return usage.strip()
|
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):
|
class SpackArgumentParser(argparse.ArgumentParser):
|
||||||
def format_help_sections(self, level):
|
def format_help_sections(self, level):
|
||||||
|
Loading…
Reference in New Issue
Block a user