Skip to content

link

The implementation of the link command.

link_cmd(
    path_or_url: str,
    destination_dir: Optional[Path] = None,
    no_input: bool = False,
    checkout: Optional[str] = None,
    directory: Optional[str] = None,
    overwrite_if_exists: bool = False,
    skip_if_file_exists: bool = False,
    default_config: bool = False,
    initial_context: Optional[
        MutableMapping[str, Any]
    ] = None,
) -> None

Link a template or configuration to an existing project.

Parameters:

path_or_url

A URL or string to add the template or configuration

TYPE: str

destination_dir

The project directory to add the layer to

TYPE: Optional[Path]

DEFAULT: None

no_input

If True force each layer’s no_input attribute to True

TYPE: bool

DEFAULT: False

checkout

The branch, tag or commit to check out after git clone

TYPE: Optional[str]

DEFAULT: None

directory

Directory within repo that holds cookiecutter.json file

TYPE: Optional[str]

DEFAULT: None

overwrite_if_exists

Overwrite the contents of the output directory if it already exists

TYPE: bool

DEFAULT: False

skip_if_file_exists

Skip the files in the corresponding directories if they already exist

TYPE: bool

DEFAULT: False

default_config

Do not load a config file. Use the defaults instead

TYPE: bool

DEFAULT: False

initial_context

The initial context for the composition

TYPE: Optional[MutableMapping[str, Any]]

DEFAULT: None

Raises:

GitError

If the destination_dir is not a git repository

GitError

If the destination_dir git repository is dirty

ValueError

If there is a .composition.yaml file in the destination directory