diff --git a/exposureinitializer/exposureinitializer.py b/exposureinitializer/exposureinitializer.py index ddd727248b1f41b8d27348374567f692ebaa8ff1..6b531909c16948f484e8c428d1c4c4b160610148 100644 --- a/exposureinitializer/exposureinitializer.py +++ b/exposureinitializer/exposureinitializer.py @@ -507,34 +507,22 @@ def command_line_interface(): # Create the argument parser and prepare for subparsers parser = argparse.ArgumentParser(description="Exposure-Initializer") - subparsers = parser.add_subparsers(help="sub-command help", dest="command") - - # Create the parser for the 'local' command - parser_local = subparsers.add_parser( - "local", help="Run initializer on a local SpatiaLite database" - ) - parser_local.add_argument( - "-e", - "--exposure-database", - required=True, - type=str, - help="Filepath to the SpatiaLite exposure database", - ) - parser_local.add_argument( + parser_shared = argparse.ArgumentParser(add_help=False) + parser_shared.add_argument( "-c", "--config-file", required=True, type=str, help="Filepath of the config file for accessing the Tiles database", ) - parser_local.add_argument( + parser_shared.add_argument( "-m", "--exposure-model", required=True, type=str, help="Search pattern for exposure files", ) - parser_local.add_argument( + parser_shared.add_argument( "-i", "--country-iso-code", required=True, @@ -542,30 +530,24 @@ def command_line_interface(): help="ISO 3166-1 alpha-3 code of the country", ) - # Create the parser for the 'server' command - parser_server = subparsers.add_parser( - "server", help="Run initializer on a server-based PostGIS database" - ) - parser_server.add_argument( - "-c", - "--config-file", - required=True, - type=str, - help="Filepath of the config file for accessing the Tiles database", + # Prepare for subparsers + subparsers = parser.add_subparsers(help="sub-command help", dest="command") + # Create the parser for the 'local' command + parser_local = subparsers.add_parser( + "local", help="Run initializer on a local SpatiaLite database", parents=[parser_shared] ) - parser_server.add_argument( - "-m", - "--exposure-model", + parser_local.add_argument( + "-e", + "--exposure-database", required=True, type=str, - help="Search pattern for exposure files", + help="Filepath to the SpatiaLite exposure database", ) - parser_server.add_argument( - "-i", - "--country-iso-code", - required=True, - type=str, - help="ISO 3166-1 alpha-3 code of the country", + # Create the parser for the 'server' command + subparsers.add_parser( + "server", + help="Run initializer on a server-based PostGIS database", + parents=[parser_shared], ) # Read arguments from command line