Skip to content

Replay mode uses the default context values instead of values in replay file #1900

@edgarrmondragon

Description

@edgarrmondragon
  • Cookiecutter version: 2.2.3
  • Template project url: NA
  • Python version: 3.11
  • Operating System: NA

Description:

Consider the following file structure:

.
├── generated
├── replay.json
└── template
    ├── cookiecutter.json
    └── {{ cookiecutter.project_name }}
        └── generated.txt

template/cookiecutter.json

{
  "project_name": "default_name",
  "greeting": "Hello, World!"
}

template/{{ cookiecutter.project_name }}/generated.txt

{{ cookiecutter.greeting }}

This is an example of a file generated with Cookiecutter.

replay.json

{
  "cookiecutter": {
    "project_name": "a_different_project_name",
    "greeting": "¡Hola, Mundo!"
  }
}

What I've run:

The following command works as expected and I get the generated project with my answers replacing the default values:

cookiecutter template -o ./generated

However, attempting to use the replay file referenced above, results in generating a project with the default values instead of the ones in the replay file:

cookiecutter --replay-file replay.json template -o generated

Results in

Hello, World!

This an example of a file generated with Cookiecutter.

Am I doing something wrong? Also, this seemed to work fine in version 2.2.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions