import click


def obj_option(*args, **kwargs):
    """
    Like `click.option`, but sets an attribute on ``ctx.obj`` instead of
    creating a parameter
    """

    def callback(ctx, param, value):
        setattr(ctx.obj, param.name, value)

    return click.option(*args, callback=callback, expose_value=False, **kwargs)