@click.command()
@click.option('--count', default=2, callback=validate_count,
              help='A positive even number.')
@click.option('--foo', help='A mysterious parameter.')
@click.option('--url', help='A URL', type=URL())
@click.version_option()
def cli(count, foo, url):
    if foo is not None and foo != 'wat':
        raise click.BadParameter('If a value is provided it needs to be the '
                                 'value "wat".', param_hint=['--foo'])
    click.echo('count: %s' % count)
    click.echo('foo: %s' % foo)
    click.echo('url: %s' % repr(url))
Validation.
dataset/ETHPy150Open pallets/click/examples/validation/validation.py/cli