def main(argv=None):
    'Main entry point before parsing command line arguments.'
    (parser, subparsers) = setup_argparse()
    args = parser.parse_args(argv)
    if args.verbose:
        level = logging.DEBUG
    else:
        formatter = logzero.LogFormatter(fmt='%(color)s[%(levelname)1.1s %(asctime)s]%(end_color)s %(message)s')
        logzero.formatter(formatter)
        level = logging.INFO
    logzero.loglevel(level=level)
    if args.config:
        config_paths = (args.config,)
    else:
        config_paths = GLOBAL_CONFIG_PATHS
    for config_path in config_paths:
        config_path = os.path.expanduser(os.path.expandvars(config_path))
        if os.path.exists(config_path):
            with open(config_path, 'rt') as tomlf:
                toml_config = toml.load(tomlf)
            break
    else:
        toml_config = None
        logger.info('Could not find any of the global configuration files %s.', config_paths)
    config = CommonConfig.create(args, toml_config)
    cmds = {None: run_nocmd, 'case': run_case}
    res = cmds[args.cmd](config, toml_config, args, parser, (subparsers.choices[args.cmd] if args.cmd else None))
    if (not res):
        logger.info('All done. Have a nice day!')
    else:
        logger.error('Something did not work out correctly.')
    return res
Main entry point before parsing command line arguments.
def main(argv=None):
    
    (parser, subparsers) = setup_argparse()
    args = parser.parse_args(argv)
    if args.verbose:
        level = logging.DEBUG
    else:
        formatter = logzero.LogFormatter(fmt='%(color)s[%(levelname)1.1s %(asctime)s]%(end_color)s %(message)s')
        logzero.formatter(formatter)
        level = logging.INFO
    logzero.loglevel(level=level)
    if args.config:
        config_paths = (args.config,)
    else:
        config_paths = GLOBAL_CONFIG_PATHS
    for config_path in config_paths:
        config_path = os.path.expanduser(os.path.expandvars(config_path))
        if os.path.exists(config_path):
            with open(config_path, 'rt') as tomlf:
                toml_config = toml.load(tomlf)
            break
    else:
        toml_config = None
        logger.info('Could not find any of the global configuration files %s.', config_paths)
    config = CommonConfig.create(args, toml_config)
    cmds = {None: run_nocmd, 'case': run_case}
    res = cmds[args.cmd](config, toml_config, args, parser, (subparsers.choices[args.cmd] if args.cmd else None))
    if (not res):
        logger.info('All done. Have a nice day!')
    else:
        logger.error('Something did not work out correctly.')
    return res