예제 #1
0
파일: cli.py 프로젝트: ThiefMaster/logstapo
def _config_callback(ctx, param, value):
    try:
        data = parse_config(value)
        config = process_config(data)
    except ConfigError as exc:
        error_echo('Could not load config file')
        error_echo(str(exc))
        ctx.exit(1)
    else:
        config['verbosity'] = ctx.params['verbose']
        config['debug'] = ctx.params['debug']
        config['dry_run'] = ctx.params['dry_run']
        return config
예제 #2
0
def _config_callback(ctx, param, value):
    try:
        data = parse_config(value)
        config = process_config(data)
    except ConfigError as exc:
        error_echo('Could not load config file')
        error_echo(str(exc))
        ctx.exit(1)
    else:
        config['verbosity'] = ctx.params['verbose']
        config['debug'] = ctx.params['debug']
        config['dry_run'] = ctx.params['dry_run']
        return config
예제 #3
0
def test_error_echo(mocker):
    secho = mocker.patch('logstapo.util.click.secho')
    util.error_echo('test')
    assert secho.called