Repository: kedro-org/kedro
File: kedro/framework/cli/starters.py (Python)

Code before:
    Replaces add-on strings with the corresponding prompt number.

    Args:
        selected_add_ons_flag: a string containing the value for the --addons flag,
            or None in case the flag wasn't used, i.e. lint,docs.

    Returns:
        String with the numbers corresponding to the desired add_ons, or
        None in case the --addons flag was not used.
    """
    if selected_add_ons_flag is None:
        return None

    addons = []
    for addon in selected_add_ons_flag.lower().split(","):
        addon_short_name = addon.strip()
        if addon_short_name in ADD_ONS_SHORTNAME_TO_NUMBER:
            addons.append(ADD_ONS_SHORTNAME_TO_NUMBER[addon_short_name])
    return ",".join(addons)


def _select_prompts_to_display(
    prompts_required: dict,
    selected_add_ons_flag: str,
    project_name: str,
    example_pipeline: bool,
) -> dict:
    """Selects which prompts an user will receive when creating a new
    Kedro project, based on what information was already made available
    through CLI input.

    Args:
        prompts_required: a dictionary of all the prompts that will be shown to
            the user on project creation.
        selected_add_ons_flag: a string containing the value for the --addons flag,
            or None in case the flag wasn't used.
        project_name: a string containing the value for the --name flag, or
            None in case the flag wasn't used.
        example_pipeline: True or False for --example flag, or
            None in case the flag wasn't used.

    Returns:
        the prompts_required dictionary, with all the redundant information removed.
    """
    valid_addons = list(ADD_ONS_SHORTNAME_TO_NUMBER) + ["all", "none"]

    if selected_add_ons_flag is not None:
        addons = re.sub(r"\s", "", selected_add_ons_flag).split(",")
        for addon in addons:
            if addon not in valid_addons:
                click.secho(

Review comment (suggestion):
`with_example_pipeline` or `use_example_pipeline` feels more natural with `bool` type. I will leave this for other to comment on since I am not the best person to provide feedback on English😅.

Code after:
    addons = []
    for addon in selected_add_ons_flag.lower().split(","):
        addon_short_name = addon.strip()
        if addon_short_name in ADD_ONS_SHORTNAME_TO_NUMBER:
            addons.append(ADD_ONS_SHORTNAME_TO_NUMBER[addon_short_name])
    return ",".join(addons)


def _select_prompts_to_display(
    prompts_required: dict,
    selected_add_ons_flag: str,
    project_name: str,
    example_pipeline: str,
) -> dict:
    """Selects which prompts an user will receive when creating a new
    Kedro project, based on what information was already made available
    through CLI input.

    Args:
        prompts_required: a dictionary of all the prompts that will be shown to
            the user on project creation.
        selected_add_ons_flag: a string containing the value for the --addons flag,
            or None in case the flag wasn't used.
        project_name: a string containing the value for the --name flag, or
            None in case the flag wasn't used.
        example_pipeline: "Yes" or "No" for --example flag, or
            None in case the flag wasn't used.

    Returns:
        the prompts_required dictionary, with all the redundant information removed.
    """
    valid_addons = list(ADD_ONS_SHORTNAME_TO_NUMBER) + ["all", "none"]

    if selected_add_ons_flag is not None:
        addons = re.sub(r"\s", "", selected_add_ons_flag).split(",")
        for addon in addons:
            if addon not in valid_addons:
                click.secho(
                    "Please select from the available add-ons: lint, test, log, docs, data, pyspark, viz, all, none",
                    fg="red",
                    err=True,
                )
                sys.exit(1)
        if ("none" in addons or "all" in addons) and len(addons) > 1:
            click.secho(
                "Add-on options 'all' and 'none' cannot be used with other options",
                fg="red",
                err=True,
            )
            sys.exit(1)
        del prompts_required["add_ons"]