cookiecutter / cookiecutter/cookiecutter

Environment variable in .cookiecutterrc file evaluation

Open
#985 1 comment 0 reactions 0 assignees View on GitHub
windows
Dominant language
Python
Stars
25.1k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

* Cookiecutter version: 1.5.1
* Python version: 3.6
* Operating System: Windows

Hey there! First of all thank you for this tool, I've always struggled to find something flexible and customizable as powerfull like this! :)

As title goes, I'd like to use the `.cookiecutterrc` with couple of custom aliases. In these aliases I use custom paths with some environment variables like this:
```
abbreviations:
mt:%MYVAR%/path/to/my_template
```

Running `$ Cookiecutter mt` this is the error Cc spits:

> A valid repository for "%MYVAR%/path/to/my_template" could not be found in the following locations:
> %MYVAR%/path/to/my_template
> C:\Users\Gruber\\.cookiecutters/%MYVAR%/path/to/my_template

What can I do to make this work? Is it possible to use the env variables in aliases paths?

Thank you!

PS.
BTW why the doube 'rr' in the config file name (.cookiecutte**rr**c)? Got me quite a headache to get it read by Cc, eventually I noticed I was missing an r! :P )

Contributor guide

Open the contributing guide

Research direction

Start with the `.cookiecutterrc` alias configuration and the `Cookiecutter mt` command using the Windows `%MYVAR%` example. Trace how the alias path is resolved, then verify that the expected expanded path is used while existing repository lookup behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.