Skip to content

Commit

Permalink
Extend add_argument_group
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbaldwin44 committed Jan 20, 2024
1 parent 02c7937 commit d574b5d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions locust/argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ class LocustArgumentParser(configargparse.ArgumentParser):
optionally exclude arguments from the UI.
"""

def add_argument_group(self, *args, **kwargs):
"""
This method supports the same args as ArgumentParser.add_argument_group(..)
Returns:
configargparse.ArgumentParser: the new argument group
extended to use the below add_argument method
"""
argument_group = super().add_argument_group(*args, **kwargs)
argument_group.add_argument = self.add_argument
argument_group.add_argument_group = self.add_argument_group

return argument_group

def add_argument(self, *args, **kwargs) -> configargparse.Action:
"""
This method supports the same args as ArgumentParser.add_argument(..)
Expand Down

0 comments on commit d574b5d

Please sign in to comment.