chiark / gitweb /
mirror: show help if no URL is provided
authorHans-Christoph Steiner <hans@eds.org>
Wed, 29 Nov 2017 13:59:48 +0000 (14:59 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Wed, 29 Nov 2017 15:31:48 +0000 (16:31 +0100)
fdroidserver/mirror.py

index 3578f3108946e4339afc90fb1399a7bc3c0c64c7..624085026c94ca4466ef35c59cf1397143194d74 100644 (file)
@@ -23,7 +23,7 @@ options = None
 def main():
     global options
 
-    parser = ArgumentParser(usage="%(prog)s [options] url")
+    parser = ArgumentParser(usage=_("%(prog)s [options] url"))
     common.setup_global_opts(parser)
     parser.add_argument("url", nargs='?', help=_("Base URL to mirror"))
     parser.add_argument("--archive", action='store_true', default=False,
@@ -32,6 +32,11 @@ def main():
                         help=_("The directory to write the mirror to"))
     options = parser.parse_args()
 
+    if options.url is None:
+        logging.error(_('A URL is required as an argument!') + '\n')
+        parser.print_help()
+        sys.exit(1)
+
     baseurl = options.url
     basedir = options.output_dir