gbp-create-remote-repo: move option parsing to separate function
authorGuido Günther <agx@sigxcpu.org>
Wed, 21 Mar 2012 21:43:42 +0000 (22:43 +0100)
committerGuido Günther <agx@sigxcpu.org>
Wed, 21 Mar 2012 22:25:54 +0000 (23:25 +0100)
Git-Dch: Ignore

gbp/scripts/create_remote_repo.py

index d1a36c6..c26551b 100644 (file)
@@ -225,28 +225,52 @@ def push_branches(remote, branches):
     gitPush([remote['url'], '--tags'])
 
 
-def main(argv):
-    retval = 0
-    changelog = 'debian/changelog'
-    cmd = []
-
+def parse_args(argv):
     parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
-                                   usage='%prog [options] - create a remote repository')
-    branch_group = GbpOptionGroup(parser, "branch options", "branch layout and tracking options")
-    branch_group.add_config_file_option(option_name="remote-url-pattern", dest="remote_url")
+                                   usage='%prog [options] - '
+                                   'create a remote repository')
+    branch_group = GbpOptionGroup(parser,
+                                  "branch options",
+                                  "branch layout and tracking options")
+    branch_group.add_config_file_option(option_name="remote-url-pattern",
+                                        dest="remote_url")
     parser.add_option_group(branch_group)
-    branch_group.add_config_file_option(option_name="upstream-branch", dest="upstream_branch")
-    branch_group.add_config_file_option(option_name="debian-branch", dest="debian_branch")
-    branch_group.add_boolean_config_file_option(option_name="pristine-tar", dest="pristine_tar")
-    branch_group.add_boolean_config_file_option(option_name="track", dest='track')
-    parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
+    branch_group.add_config_file_option(option_name="upstream-branch",
+                                        dest="upstream_branch")
+    branch_group.add_config_file_option(option_name="debian-branch",
+                                        dest="debian_branch")
+    branch_group.add_boolean_config_file_option(option_name="pristine-tar",
+                                                dest="pristine_tar")
+    branch_group.add_boolean_config_file_option(option_name="track",
+                                                dest='track')
+    parser.add_option("-v", "--verbose",
+                      action="store_true",
+                      dest="verbose",
+                      default=False,
                       help="verbose command execution")
-    parser.add_config_file_option(option_name="color", dest="color", type='tristate')
-    parser.add_option("--remote-name", dest="name", default="origin",
+    parser.add_config_file_option(option_name="color",
+                                  dest="color",
+                                  type='tristate')
+    parser.add_option("--remote-name",
+                      dest="name",
+                      default="origin",
                       help="The name of the remote, default is 'origin'")
-    parser.add_config_file_option(option_name="template-dir", dest="template_dir")
+    parser.add_config_file_option(option_name="template-dir",
+                                  dest="template_dir")
+    parser.add_config_file_option(option_name="remote-template",
+                                  dest="remote_template")
 
     (options, args) = parser.parse_args(argv)
+
+    return options, args
+
+
+def main(argv):
+    retval = 0
+    changelog = 'debian/changelog'
+    cmd = []
+
+    options, args = parse_args(argv)
     gbp.log.setup(options.color, options.verbose)
 
     try: