@@ -0,0 +1,2716 @@
+# The GeoTag-X command line toolkit.%0A# This module contains the toolkit's entry point.%0A#%0A# Copyright (c) 2016 UNITAR/UNOSAT%0A#%0A# The MIT License (MIT)%0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this software and associated documentation files (the %22Software%22), to deal%0A# in the Software without restriction, including without limitation the rights%0A# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0A# copies of the Software, and to permit persons to whom the Software is%0A# furnished to do so, subject to the following conditions:%0A#%0A# The above copyright notice and this permission notice shall be included in all%0A# copies or substantial portions of the Software.%0A#%0A# THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND,%0A# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF%0A# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.%0A# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,%0A# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR%0A# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE%0A# OR OTHER DEALINGS IN THE SOFTWARE.%0Adef init_argument_parser():%0A%09%22%22%22Initializes the toolkit's command line argument parser.%22%22%22%0A%09from __init__ import __version__%0A%09import argparse%0A%09parser = argparse.ArgumentParser(%0A%09%09prog=%22geotagx%22,%0A%09%09description=%22A set of tools that help manage a GeoTag-X server.%22,%0A%09%09add_help=False%0A%09)%0A%09parser.set_defaults(handler=None)%0A%09options = parser.add_argument_group(%22OPTIONS%22)%0A%09options.add_argument(%22-h%22, %22--help%22, action=%22help%22, help=%22Display this help and exit.%22)%0A%09options.add_argument(%22--version%22, action=%22version%22, help=%22Display version information and exit.%22, version=%22%22%22%0A%09%09GeoTag-X Command Line Toolkit v%25s, Copyright (C) UNITAR/UNOSAT.%0A%09%22%22%22 %25 __version__)%0A%0A%09return parser%0A%0A%0Adef main(argv=None):%0A%09import sys%0A%09# import geotagx.build.core%0A%09import geotagx.sanitize.core%0A%0A%09parser = init_argument_parser()%0A%0A%09# Initialize each tool's argument parser.%0A%09subparsers = parser.add_subparsers(%0A%09%09title=%22COMMANDS%22,%0A%09%09metavar=%22%22,%0A%09%09description=%22The following is a set of commands you can use to select a specific tool.%22,%0A%09%09prog=%22geotagx%22%0A%09)%0A%09parents = %5Bparser%5D%0A%09initializers = %5B%0A%09%09# geotagx.build.core.init_argument_parser,%0A%09%09geotagx.sanitize.core.init_argument_parser%0A%09%5D%0A%09for initializer in initializers:%0A%09%09initializer(subparsers, parents)%0A%0A%09arguments = parser.parse_args(sys.argv%5B1:%5D if argv is None else argv)%0A%0A%09# Make sure the 'handler' argument is callable (a function or method).%0A%09run = arguments.handler%0A%09if not hasattr(run, %22__call__%22):%0A%09%09parser.error(%22The 'handler' argument is not callable.%22)%0A%0A%09run(arguments)%0A%09return 0%0A

Add the core module