Beispiel #1
0
    def decorate(f, **kwargs):
        """
        Work of actually decorating a function -- wrapped in here because we
        want to dispatch depending on how `common_options` is invoked
        """
        f = version_option(f)
        f = debug_option(f)
        f = verbose_option(f)
        f = click.help_option('-h', '--help')(f)

        # if the format option is being allowed, it needs to be applied to `f`
        if not kwargs.get('no_format_option'):
            f = format_option(f)

        # if the --map-http-status option is being allowed, ...
        if not kwargs.get('no_map_http_status_option'):
            f = map_http_status_option(f)

        return f
Beispiel #2
0
    def decorate(f, **kwargs):
        """
        Work of actually decorating a function -- wrapped in here because we
        want to dispatch depending on how `common_options` is invoked
        """
        f = version_option(f)
        f = debug_option(f)
        f = verbose_option(f)
        f = click.help_option("-h", "--help")(f)

        # if the format option is being allowed, it needs to be applied to `f`
        if not kwargs.get("no_format_option"):
            f = format_option(f)

        # if the --map-http-status option is being allowed, ...
        if not kwargs.get("no_map_http_status_option"):
            f = map_http_status_option(f)

        return f