Main function.

def main(args=None):
    """Main function."""
    parser = get_parser()
    args = parser.parse_args(args=args)
    Logger.set_level(args.level)

    colorama_args = {'autoreset': True}
    if args.no_color:
        colorama_args['strip'] = True
    colorama.init(**colorama_args)

    config = None
    if args.no_config:
        logger.info('--no-config flag used, use default configuration')
        if args.input_file:
            logger.info('Input file specified: %s' % args.input_file)
            file_path = args.input_file
        else:
            logger.info('No input file specified, will read standard input')
            file_path = sys.stdin
        config = Config.default_config(file_path)
    else:
        if args.config_file:
            logger.info('Configuration file specified: %s' % args.config_file)
            config_file = args.config_file
        else:
            logger.info('No configuration file specified, searching')
            config_file = Config.find()
        if config_file:
            logger.info('Load configuration from %s' % config_file)
            config = Config.from_file(config_file)
        if config is None:
            logger.info('No configuration file found, use default one')
            config = Config.default_config()

    logger.debug('Configuration = {}'.format(config))
    logger.debug('Plugins loaded = {}'.format(config.plugins))

    if args.list_plugins:
        logger.info('Print list of plugins')
        config.print_plugins()
        return 0

    logger.info('Run analysis')
    analysis = Analysis(config)
    try:
        analysis.run(verbose=False)
        logger.info('Analysis successful: %s' % analysis.successful)
        logger.info('Output results as TAP')
        analysis.output_tap()
        return 0 if analysis.successful else 1
    except KeyboardInterrupt:
        logger.info('Keyboard interruption, aborting')
        return 130