Skip to content

Make sam init work with custom locations with multiple templates #3555

Description

@ljacobsson

Describe your idea/feature/enhancement

When running sam init the user is guided through a drill-down UI based on the content of aws/aws-sam-cli-app-templates. It seems to be controlled by the manifest.json file in the root.

Users who want to develop custom project templates are instructed to use the --location option, like sam init --location gh:myorg/myrepo. However, that expects a single project template in the root of that repo which leads organisations who want to provide more than one custom project template to use multiple repositories which quickly gets hard to maintain.

Proposal

Allow users to design custom repositories the same way as aws/aws-sam-cli-app-templates which get presented the same way as the default templates when running sam init --location ...

It looks like cookiecutter 1.7 supports defining a --directory (docs)

Additional Details

I maintain sam-patterns-cli - a tool that lets developers merge in SAM patterns from serverlessland.com/patterns into their templates. I've recently added a command to it that lets users initialise projects based on the templates in aws/aws-sam-cli-app-templates with the option to add custom repositories that follow the same structure.

Here I've configured the tool to include a custom location:
init

I'm hoping to be able to use this way of structuring custom templates with sam-cli to avoid diverging away from it and keep backward compatability

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions