add
The implementation of the add command.
Functions¶
add_cmd
¶
add_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,
accept_hooks: str = "all",
initial_context: Optional[
MutableMapping[str, Any]
] = None,
) -> None
Add 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
DEFAULT:
None
no_input
-
If
True
force each layer’sno_input
attribute toTrue
TYPE:
bool
DEFAULT:
False
checkout
-
The branch, tag or commit to check out after git clone
DEFAULT:
None
directory
-
Directory within repo that holds cookiecutter.json file
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
accept_hooks
-
How to deal with pre/post hooks
TYPE:
str
DEFAULT:
'all'
initial_context
-
The initial context for the composition layer
TYPE:
Optional[MutableMapping[str, Any]]
DEFAULT:
None
Raises:
-
GitError
-
If the destination_dir is not a git repository
-
ValueError
-
If there is not a .composition.yaml file in the destination directory