Repository: kedro-org/kedro

Issue:
Remove redundant hint if user is already using the hint
## Description
<!-- Short description of the problem here. -->

If users use `kedro new --addons all --name all --example y` then the message:

```
To skip the interactive flow you can run `kedro new` with
kedro new --name=<your-project-name> --addons=<your-addons> --example=<yes/no>
```

Should not appear at the end. See the red highlight below:

<img width="1164" alt="image" src="https://github.com/kedro-org/kedro/assets/90610031/c1bde879-157b-48f7-8a40-a4d6cc3f771d">



Discussion:
merelcht: > Instead of testing the negative case, the tests test that the hint is shown where relevant. Manual testing reveals the hint is no longer shown where already used. Unsure on best practice here - happy to include a unit test for the negative case as well.

IMO it would be good to also add the negative case, see e.g. https://github.com/kedro-org/kedro/pull/3424/files

Patch:
diff --git a/kedro/framework/cli/starters.py b/kedro/framework/cli/starters.py
index 0cdfb170..3931b195 100644
--- a/kedro/framework/cli/starters.py
+++ b/kedro/framework/cli/starters.py
@@ -299,6 +299,13 @@ def new(  # noqa: PLR0913
 
     _create_project(project_template, cookiecutter_args)
 
+    if prompts_required and not config_path and not starter_alias:
+        click.secho(
+            "\nTo skip the interactive flow you can run `kedro new` with"
+            "\nkedro new --name=<your-project-name> --tools=<your-project-tools> --example=<yes/no>",
+            fg="green",
+        )
+
 
 @starter.command("list")
 def list_starters():
@@ -838,7 +845,7 @@ def _create_project(template_path: str, cookiecutter_args: dict[str, Any]):
 
     # we can use starters without tools:
     if tools is not None:
-        if tools == "[]":  # TODO: This should be a list
+        if tools in ("[]", ""):  # TODO: This should be a list
             click.secho(
                 "You have selected no project tools",
                 fg="green",
@@ -856,12 +863,6 @@ def _create_project(template_path: str, cookiecutter_args: dict[str, Any]):
                 fg="green",
             )
 
-    click.secho(
-        "\nTo skip the interactive flow you can run `kedro new` with"
-        "\nkedro new --name=<your-project-name> --tools=<your-project-tools> --example=<yes/no>",
-        fg="green",
-    )
-
 
 class _Prompt:
     """Represent a single CLI prompt for `kedro new`"""


Test patch:
diff --git a/tests/framework/cli/test_starters.py b/tests/framework/cli/test_starters.py
index 4b07adee..d85ce775 100644
--- a/tests/framework/cli/test_starters.py
+++ b/tests/framework/cli/test_starters.py
@@ -854,6 +854,20 @@ class TestNewWithStarterValid:
         assert kwargs.items() <= mock_determine_repo_dir.call_args[1].items()
         assert kwargs.items() <= mock_cookiecutter.call_args[1].items()
 
+    def test_no_hint(self, fake_kedro_cli):
+        shutil.copytree(TEMPLATE_PATH, "template")
+        result = CliRunner().invoke(
+            fake_kedro_cli,
+            ["new", "-v", "--starter", str(Path("./template").resolve())],
+            input=_make_cli_prompt_input(),
+        )
+        assert (
+            "To skip the interactive flow you can run `kedro new` with\nkedro new --name=<your-project-name> --tools=<your-project-tools> --example=<yes/no>"
+            not in result.output
+        )
+        _assert_template_ok(result)
+        _clean_up_project(Path("./new-kedro-project"))
+
 
 class TestNewWithStarterInvalid:
     def test_invalid_starter(self, fake_kedro_cli):
@@ -965,8 +979,6 @@ class TestToolsAndExampleFromUserPrompts:
             "5",
             "6",
             "7",
-            "none",
-            "",
             "2,3,4",
             "3-5",
             "1,2,4-6",
@@ -992,6 +1004,37 @@ class TestToolsAndExampleFromUserPrompts:
 
         _assert_template_ok(result, tools=tools, example_pipeline=example_pipeline)
         _assert_requirements_ok(result, tools=tools)
+        assert "You have selected the following project tools:" in result.output
+        assert (
+            "To skip the interactive flow you can run `kedro new` with\nkedro new --name=<your-project-name> --tools=<your-project-tools> --example=<yes/no>"
+            in result.output
+        )
+        _clean_up_project(Path("./new-kedro-project"))
+
+    @pytest.mark.parametrize(
+        "tools",
+        [
+            "none",
+            "",
+        ],
+    )
+    @pytest.mark.parametrize("example_pipeline", ["Yes", "No"])
+    def test_no_tools_and_example(self, fake_kedro_cli, tools, example_pipeline):
+        result = CliRunner().invoke(
+            fake_kedro_cli,
+            ["new"],
+            input=_make_cli_prompt_input(
+                tools=tools, example_pipeline=example_pipeline
+            ),
+        )
+
+        _assert_template_ok(result, tools=tools, example_pipeline=example_pipeline)
+        _assert_requirements_ok(result, tools=tools)
+        assert "You have selected no project tools" in result.output
+        assert (
+            "To skip the interactive flow you can run `kedro new` with\nkedro new --name=<your-project-name> --tools=<your-project-tools> --example=<yes/no>"
+            in result.output
+        )
         _clean_up_project(Path("./new-kedro-project"))
 
     @pytest.mark.parametrize(
@@ -1115,6 +1158,10 @@ class TestToolsAndExampleFromConfigFile:
 
         _assert_template_ok(result, **config)
         _assert_requirements_ok(result, tools=tools, repo_name="new-kedro-project")
+        assert (
+            "To skip the interactive flow you can run `kedro new` with\nkedro new --name=<your-project-name> --tools=<your-project-tools> --example=<yes/no>"
+            not in result.output
+        )
         _clean_up_project(Path("./new-kedro-project"))
 
     @pytest.mark.parametrize(
@@ -1293,6 +1340,10 @@ class TestToolsAndExampleFromCLI:
         tools = _convert_tool_names_to_numbers(selected_tools=tools)
         _assert_template_ok(result, tools=tools, example_pipeline=example_pipeline)
         _assert_requirements_ok(result, tools=tools, repo_name="new-kedro-project")
+        assert (
+            "To skip the interactive flow you can run `kedro new` with\nkedro new --name=<your-project-name> --tools=<your-project-tools> --example=<yes/no>"
+            in result.output
+        )
         _clean_up_project(Path("./new-kedro-project"))
 
     def test_invalid_tools_flag(self, fake_kedro_cli):
@@ -1325,6 +1376,27 @@ class TestToolsAndExampleFromCLI:
             in result.output
         )
 
+    def test_flags_skip_interactive_flow(self, fake_kedro_cli):
+        result = CliRunner().invoke(
+            fake_kedro_cli,
+            [
+                "new",
+                "--name",
+                "New Kedro Project",
+                "--tools",
+                "none",
+                "--example",
+                "no",
+            ],
+        )
+
+        assert result.exit_code == 0
+        assert (
+            "To skip the interactive flow you can run `kedro new` with\nkedro new --name=<your-project-name> --tools=<your-project-tools> --example=<yes/no>"
+            not in result.output
+        )
+        _clean_up_project(Path("./new-kedro-project"))
+
 
 @pytest.mark.usefixtures("chdir_to_tmp")
 class TestNameFromCLI: