summary refs log tree commit diff
path: root/synapse/config/_base.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-07-15 13:43:25 +0100
committerErik Johnston <erik@matrix.org>2019-07-15 14:09:35 +0100
commitfdefb9e29a7c28e5b218fc8d9745a2ec58bc3d27 (patch)
tree897e196ec367fa598aee1521addffad431478c14 /synapse/config/_base.py
parentFix up comments (diff)
downloadsynapse-fdefb9e29a7c28e5b218fc8d9745a2ec58bc3d27.tar.xz
Move creation of ArgumentParser to caller
Diffstat (limited to 'synapse/config/_base.py')
-rw-r--r--synapse/config/_base.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py
index 74a7980ebe..8c3acff03e 100644
--- a/synapse/config/_base.py
+++ b/synapse/config/_base.py
@@ -231,27 +231,24 @@ class Config(object):
 
         Returns: Config object.
         """
-        config_parser = cls.create_argument_parser(description)
+        config_parser = argparse.ArgumentParser(description=description)
+        cls.add_arguments_to_parser(config_parser)
         obj, _ = cls.load_config_with_parser(config_parser, argv)
 
         return obj
 
     @classmethod
-    def create_argument_parser(cls, description):
-        """Create an ArgumentParser instance with all the config flags.
+    def add_arguments_to_parser(cls, config_parser):
+        """Adds all the config flags to an ArgumentParser.
 
         Doesn't support config-file-generation: used by the worker apps.
 
         Used for workers where we want to add extra flags/subcommands.
 
         Args:
-            description (str): App description
-
-        Returns:
-            ArgumentParser
+            config_parser (ArgumentParser): App description
         """
 
-        config_parser = argparse.ArgumentParser(description=description)
         config_parser.add_argument(
             "-c",
             "--config-path",
@@ -273,8 +270,6 @@ class Config(object):
         # `add_arguments` should be side effect free so this is probably fine.
         cls.invoke_all_static("add_arguments", config_parser)
 
-        return config_parser
-
     @classmethod
     def load_config_with_parser(cls, config_parser, argv):
         """Parse the commandline and config files with the given parser