Skip to content

prompt

This module contains prompts used when building a ssb-project.

confirm_fix_ssb_git_config(project_name, template_repo_url, checkout, project_directory, valid_global_git_config, valid_project_git_config)

Prompts user for conformation regarding reset of git configuration files.

Parameters:

Name Type Description Default
project_name str

Name of project

required
template_repo_url str

URL for the chosen template

required
checkout str | None

The git reference to check against. Supports branches, tags and commit hashes.

required
project_directory Path

Directory of the project.

required
valid_global_git_config bool

True if global git is configured according to company policy.

required
valid_project_git_config bool

True if local git files are configured according to company policy.

required
Source code in ssb_project_cli/ssb_project/build/prompt.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
def confirm_fix_ssb_git_config(
    project_name: str,
    template_repo_url: str,
    checkout: str | None,
    project_directory: Path,
    valid_global_git_config: bool,
    valid_project_git_config: bool,
) -> None:
    """Prompts user for conformation regarding reset of git configuration files.

    Args:
        project_name: Name of project
        template_repo_url: URL for the chosen template
        checkout: The git reference to check against. Supports branches, tags and commit hashes.
        project_directory: Directory of the project.
        valid_global_git_config: True if global git is configured according to company policy.
        valid_project_git_config:True if local git files are configured according to company policy.
    """
    valid_global_git_config_tuple = (".gitconfig", "")
    valid_project_git_config_tuple = (".gitattributes and .gitignore", "")
    changed_files = f"{valid_global_git_config_tuple[valid_global_git_config]} {valid_project_git_config_tuple[valid_project_git_config]}"

    # Default is set to None makes typer repeat until input y/n is given.
    if typer.confirm(
        f"\n\tWould you like to reset your Git configuration to the SSB recommended defaults?\n\tThis action will override changes you have made to: {changed_files}",
        default=None,
    ):
        print()  # Formatting print
        if not valid_global_git_config:
            reset_global_gitconfig()
        if not valid_project_git_config:
            reset_project_git_configuration(
                project_name, template_repo_url, checkout, project_directory
            )