diff --git a/taipy/_cli/_scaffold_cli.py b/taipy/_cli/_create_cli.py similarity index 90% rename from taipy/_cli/_scaffold_cli.py rename to taipy/_cli/_create_cli.py index d0e48e56bf..d0bea7bab6 100644 --- a/taipy/_cli/_scaffold_cli.py +++ b/taipy/_cli/_create_cli.py @@ -22,11 +22,11 @@ from ._base_cli._taipy_parser import _TaipyParser -class _ScaffoldCLI(_AbstractCLI): +class _CreateCLI(_AbstractCLI): _template_map: Dict[str, str] = {} _COMMAND_NAME = "create" - _ARGUMENTS = ["--template"] + _ARGUMENTS = ["--application"] @classmethod def generate_template_map(cls, template_path: Optional[pathlib.Path] = None): @@ -49,10 +49,10 @@ def create_parser(cls): help="Create a new Taipy application using pre-defined templates.", ) create_parser.add_argument( - "--template", + "--application", choices=list(cls._template_map.keys()), default="default", - help="The Taipy template to create new application.", + help="The template name to create a new Taipy application.", ) @classmethod @@ -61,7 +61,7 @@ def handle_command(cls): if not args: return try: - cookiecutter(cls._template_map[args.template]) + cookiecutter(cls._template_map[args.application]) except OutputDirExistsException as err: error_msg = f"{str(err)}. Please remove the existing directory or provide a new folder name." print(error_msg) # noqa: T201 diff --git a/taipy/_entrypoint.py b/taipy/_entrypoint.py index 5904e560ce..d185f9f5de 100644 --- a/taipy/_entrypoint.py +++ b/taipy/_entrypoint.py @@ -19,9 +19,9 @@ from taipy.core._version._cli._version_cli import _VersionCLI from taipy.gui._gui_cli import _GuiCLI +from ._cli._create_cli import _CreateCLI from ._cli._help_cli import _HelpCLI from ._cli._run_cli import _RunCLI -from ._cli._scaffold_cli import _ScaffoldCLI from .version import _get_version @@ -46,8 +46,8 @@ def _entrypoint(): _CoreCLI.create_run_parser() _VersionCLI.create_parser() - _ScaffoldCLI.generate_template_map() - _ScaffoldCLI.create_parser() + _CreateCLI.generate_template_map() + _CreateCLI.create_parser() _MigrateCLI.create_parser() _HelpCLI.create_parser() @@ -65,7 +65,7 @@ def _entrypoint(): _HelpCLI.handle_command() _VersionCLI.handle_command() _MigrateCLI.handle_command() - _ScaffoldCLI.handle_command() + _CreateCLI.handle_command() _TaipyParser._remove_argument("help") _TaipyParser._parser.print_help() diff --git a/tests/cli/test_help_cli.py b/tests/cli/test_help_cli.py index 6017e5cf0f..fd5f27c077 100644 --- a/tests/cli/test_help_cli.py +++ b/tests/cli/test_help_cli.py @@ -58,7 +58,7 @@ def test_help_non_existed_command(caplog): def test_taipy_create_help(capsys): - expected_help = "create [-h] [--template" + expected_help = "create [-h] [--application" with patch("sys.argv", ["prog", "help", "create"]): with pytest.raises(SystemExit): diff --git a/tests/templates/test_template_cli.py b/tests/templates/test_template_cli.py index 43f7e58a3a..792c54e80a 100644 --- a/tests/templates/test_template_cli.py +++ b/tests/templates/test_template_cli.py @@ -18,14 +18,14 @@ def test_create_cli_with_wrong_arguments(caplog): - with patch("sys.argv", ["prog", "create", "--teamplaet", "default"]): + with patch("sys.argv", ["prog", "create", "--applciation", "default"]): with pytest.raises(SystemExit): _entrypoint() - assert "Unknown arguments: --teamplaet. Did you mean: --template?" in caplog.text + assert "Unknown arguments: --applciation. Did you mean: --application?" in caplog.text def test_create_cli_with_unsupported_template(capsys): - with patch("sys.argv", ["prog", "create", "--template", "not-a-template"]): + with patch("sys.argv", ["prog", "create", "--application", "not-a-template"]): with pytest.raises(SystemExit): _entrypoint() _, err = capsys.readouterr()