8000 Allow cookiecutter to work from subdirectory in repo · Issue #1223 · cookiecutter/cookiecutter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Allow cookiecutter to work from subdirectory in repo #1223
Open
@RomHartmann

Description

@RomHartmann
  • Cookiecutter version: 1.6.0
  • Template project url: private repo, of format https://github.com/user/repo-name.git
  • Python version: 3.6.5 or 3.7.2
  • Operating System: Mac OS X 10.14.6

Description:

I would like my cookiecutter to function as a repo subdirectory (for example all of my cookiecutters as subdirectories in a single repo). Something like this:

cookiecutter https://github.com/user/repo-name.git --subdirectory="mycookiecutter"

or maybe --cd="" instead of --subdirectory="" 🤔

What I've run:

cookiecutter https://github.com/user/repo-name.git fails with

A valid repository for "https://github.com/user/repo-name.git" could not be found in the following locations:
/Users/romanhartmann/.cookiecutters/repo-name

I've gone through the cli.py and found that there isn't an undocumented way to do this.

What I propose

I'll create a PR for this shortly, but basically:

  • cli.py gets another option, --subdirectory
  • repository.py receives the argument and cloned_repo = os.path.join(cloned_repo, subdirectory)

That's it really. Now cookiecutter works with subdirectories too!

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionenhancementThis issue/PR relates to a feature request.waiting-for-contributorWaiting for answer from original contributor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0