Common CLI options shared by "local invoke" and "local start-api" commands

    :param f: Callback passed by Click

def invoke_common_options(f):
    """
    Common CLI options shared by "local invoke" and "local start-api" commands

    :param f: Callback passed by Click
    """

    invoke_options = [
        template_click_option(),

        click.option('--env-vars', '-n',
                     type=click.Path(exists=True),
                     help="JSON file containing values for Lambda function's environment variables."),

        parameter_override_click_option(),

        click.option('--debug-port', '-d',
                     help="When specified, Lambda function container will start in debug mode and will expose this "
                          "port on localhost.",
                     envvar="SAM_DEBUG_PORT"),

        click.option('--debugger-path',
                     help="Host path to a debugger that will be mounted into the Lambda container."),

        click.option('--debug-args',
                     help="Additional arguments to be passed to the debugger.",
                     envvar="DEBUGGER_ARGS"),

        click.option('--docker-volume-basedir', '-v',
                     envvar="SAM_DOCKER_VOLUME_BASEDIR",
                     help="Specifies the location basedir where the SAM file exists. If the Docker is running on "
                          "a remote machine, you must mount the path where the SAM file exists on the docker machine "
                          "and modify this value to match the remote machine."),

        click.option('--log-file', '-l',
                     help="logfile to send runtime logs to."),

        click.option('--layer-cache-basedir',
                     type=click.Path(exists=False, file_okay=False),
                     envvar="SAM_LAYER_CACHE_BASEDIR",
                     help="Specifies the location basedir where the Layers your template uses will be downloaded to.",
                     default=get_default_layer_cache_dir()),

    ] + docker_click_options() + [

        click.option('--force-image-build',
                     is_flag=True,
                     help='Specify whether CLI should rebuild the image used for invoking functions with layers.',
                     envvar='SAM_FORCE_IMAGE_BUILD',
                     default=False),

    ]

    # Reverse the list to maintain ordering of options in help text printed with --help
    for option in reversed(invoke_options):
        option(f)

    return f