def main():
    """ main """
    # BZ 1581651 - Override the ArgumentParser to disable argument abbreviations.
    parser = OverrideArgumentParser(
        description=u'APB tooling for '
        u'assisting in building and packaging APBs.'
    )

    parser.add_argument(
        '--debug',
        action='store_true',
        dest='debug',
        help=u'Enable debug output',
        default=False
    )

    # TODO: Modify project to accept relative paths
    parser.add_argument(
        '--project',
        '-p',
        action='store',
        dest='base_path',
        help=u'Specify a path to your project. Defaults to CWD.',
        default=os.getcwd()
    )

    parser.add_argument(
        '--token',
        action='store',
        dest='auth_token',
        help=u'Specify OpenShift auth token to be used',
        default=None
    )

    subparsers = parser.add_subparsers(title='subcommand', dest='subcommand')
    subparsers.required = True

    for subcommand in AVAILABLE_COMMANDS:
        subparser = subparsers.add_parser(
            subcommand, help=AVAILABLE_COMMANDS[subcommand]
        )
        globals()['subcmd_%s_parser' % subcommand](subparser)

    args = parser.parse_args()

    if args.subcommand == 'help':
        parser.print_help()
        sys.exit(0)

    if args.subcommand == 'version':
        version = pkg_resources.require("apb")[0].version
        print("Version: apb-%s" % version)
        sys.exit(0)

    try:
        getattr(apb.engine,
                u'cmdrun_{}'.format(args.subcommand))(**vars(args))
    except Exception as e:
        print("Exception occurred! %s" % e)
        sys.exit(1)