diff --git a/django_typer/__init__.py b/django_typer/__init__.py index b9fe742b..55579af9 100644 --- a/django_typer/__init__.py +++ b/django_typer/__init__.py @@ -1682,7 +1682,7 @@ def command2(self, option: t.Optional[str] = None): command_tree: CommandNode @property - def name(self) -> str: + def _name(self) -> str: """The name of the django command""" return self.typer_app.info.name or self.__module__.rsplit(".", maxsplit=1)[-1] @@ -1715,7 +1715,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): getattr(self, "_called_from_command_line", False) and not self._traceback ): - self.print_help(sys.argv[0], self.name, *cmd_pth) + self.print_help(sys.argv[0], self._name, *cmd_pth) self.stderr.write(err_msg) sys.exit(1) raise CommandError(str(exc_val)) from exc_val diff --git a/django_typer/tests/tests.py b/django_typer/tests/tests.py index 70ad983f..c6eabfbc 100644 --- a/django_typer/tests/tests.py +++ b/django_typer/tests/tests.py @@ -110,7 +110,7 @@ def test_command_line(self): ) def test_cmd_name(self): - self.assertEqual(get_command("shellcompletion").name, "shellcompletion") + self.assertEqual(get_command("shellcompletion")._name, "shellcompletion") def test_call_command(self): out = StringIO() diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 4bf025bd..9341d56b 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -5,6 +5,7 @@ Change Log v1.0.2 ====== +* Fixed `name property on TyperCommand is too generic and should be private. `_ * Fixed `When usage errors are thrown the help output should be that of the subcommand invoked not the parent group. `_ * Fixed `typer installs its own system exception hook when commands are run and this may step on the installed rich hook `_ * Fixed `Add py.typed stub `_