import json


def config_file(request, tmp_path, repo_path):
    """
    Create a temporary config file to use with the -c option.

    The file will configure repo_path as the template repository and add any keyword arguments for the prefilled_values marker as prefilled values. If no such marker is present, the Name "Clark Kent" and Email "kent@daily-planet.com" is added.
    """
    prefilled = dict(Name="Clark Kent", Email="kent@daily-planet.com")

    marker = request.node.get_closest_marker("prefilled_values")
    if marker is not None:
        prefilled = dict(**marker.kwargs)

    config_file = tmp_path / "config.json"
    config_file.write_text(json.dumps(dict(TPLDIR=str(repo_path), prefilled=prefilled)))

    return config_file