templates module
API provided in templates.py
module. This module contains functions for easy interaction with cookiecutter
templates.
Usage in package api
from git_system_follower.develop.api.templates import create_template, update_template, delete_template
Examples
from git_system_follower.develop.api.types import Parameters
from git_system_follower.develop.api.templates import create_template, delete_template
def main(parameters: Parameters):
delete_template(parameters)
create_template(parameters, 'default')
Functions description
get_template_names
function
Return tuple of template names
Arguments
Name | Type | Description |
---|---|---|
parameters |
Parameters |
parameters that were passed to the package api |
create_template
function
def create_template(
parameters: Parameters, template_name: str, *,
is_force: bool = False
) -> None:
cookiecutter
template
If is_force
parameter is False
, then it will necessarily be safe to create files using template:
- If file doesn't exist: create file
- If file exists:
- Files content doesn't match: notification of this (warning)
- Files content matches: notification of this (info)
If is_force
parameter is True
, then it will necessarily be force to create files using template:
- If file doesn't exist: create file
- If file exists:
- Files content doesn't match: overwrite this file, notification of this (warning)
- Files content matches: notification of this (info)
Arguments
Name | Type | Description |
---|---|---|
parameters |
Parameters |
parameters that were passed to the package api |
template_name |
str |
name of template to be created |
Keyword arguments
Name | Type | Description |
---|---|---|
is_force |
bool |
forced creation (ignore file content) |
update_template
function
Update files using cookiecutter
template
If is_force
parameter is False
, then it will necessarily be safe to update files using template:
- If file doesn't exist: create file
- If file exists: do nothing
- Files content doesn't match: notification of this (warning)
- Files content matches: notification of this (info)
If is_force
parameter is True
, then it will necessarily be force to update files using template:
- If file doesn't exist: create file
- If file exists:
- Files content doesn't match: overwrite this file, notification of this (warning)
- Files content matches: notification of this (info)
Arguments
Name | Type | Description |
---|---|---|
parameters |
Parameters |
parameters that were passed to the package api |
Keyword arguments
Name | Type | Description |
---|---|---|
is_force |
bool |
forced creation (ignore file content) |
delete_template
function
Delete files using cookiecutter
template
If is_force
parameter is False
, then it will necessarily be safe to delete files using template:
- If file doesn't exist: do nothing
- If file exists:
- Files content doesn't match: notification of this (warning)
- Files content matches: delete this file, notification of this (info)
If is_force
parameter is True
, then it will necessarily be force to delete files using template:
- If file doesn't exist: do nothing
- If file exists:
- Files content doesn't match: delete this file, notification of this (warning)
- Files content matches: delete this file, notification of this (info)
Arguments
Name | Type | Description |
---|---|---|
parameters |
Parameters |
parameters that were passed to the package api |
Keyword arguments
Name | Type | Description |
---|---|---|
is_force |
bool |
forced deletion (ignore file content) |