import click


def n_protocols_option(required=True, **kwargs):
    """Get option for number of protocols."""

    def custom_n_protocols_option(func):
        def callback(ctx, param, value):
            value = abs(value)
            ctx.meta["protocols_number"] = value
            return value

        return click.option(
            "-pn",
            "--protocols-number",
            type=click.INT,
            show_default=True,
            required=required,
            help="The number of protocols of cross validation.",
            callback=callback,
            **kwargs
        )(func)

    return custom_n_protocols_option