Unverified Commit 93dee88f authored by Chauncey's avatar Chauncey Committed by GitHub
Browse files

[Misc] vllm CLI flags should be ordered for better user readability (#10017)


Signed-off-by: default avatarchaunceyjiang <chaunceyjiang@gmail.com>
parent 7a83b1ae
...@@ -1148,9 +1148,23 @@ class StoreBoolean(argparse.Action): ...@@ -1148,9 +1148,23 @@ class StoreBoolean(argparse.Action):
"Expected 'true' or 'false'.") "Expected 'true' or 'false'.")
class SortedHelpFormatter(argparse.HelpFormatter):
"""SortedHelpFormatter that sorts arguments by their option strings."""
def add_arguments(self, actions):
actions = sorted(actions, key=lambda x: x.option_strings)
super(SortedHelpFormatter, self).add_arguments(actions)
class FlexibleArgumentParser(argparse.ArgumentParser): class FlexibleArgumentParser(argparse.ArgumentParser):
"""ArgumentParser that allows both underscore and dash in names.""" """ArgumentParser that allows both underscore and dash in names."""
def __init__(self, *args, **kwargs):
# Set the default 'formatter_class' to SortedHelpFormatter
if 'formatter_class' not in kwargs:
kwargs['formatter_class'] = SortedHelpFormatter
super().__init__(*args, **kwargs)
def parse_args(self, args=None, namespace=None): def parse_args(self, args=None, namespace=None):
if args is None: if args is None:
args = sys.argv[1:] args = sys.argv[1:]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment