Skip to content

Commit cdbefaa

Browse files
committed
make name property private #37
1 parent 48d42ea commit cdbefaa

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

django_typer/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ def command2(self, option: t.Optional[str] = None):
16821682
command_tree: CommandNode
16831683

16841684
@property
1685-
def name(self) -> str:
1685+
def _name(self) -> str:
16861686
"""The name of the django command"""
16871687
return self.typer_app.info.name or self.__module__.rsplit(".", maxsplit=1)[-1]
16881688

@@ -1715,7 +1715,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
17151715
getattr(self, "_called_from_command_line", False)
17161716
and not self._traceback
17171717
):
1718-
self.print_help(sys.argv[0], self.name, *cmd_pth)
1718+
self.print_help(sys.argv[0], self._name, *cmd_pth)
17191719
self.stderr.write(err_msg)
17201720
sys.exit(1)
17211721
raise CommandError(str(exc_val)) from exc_val

django_typer/tests/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_command_line(self):
110110
)
111111

112112
def test_cmd_name(self):
113-
self.assertEqual(get_command("shellcompletion").name, "shellcompletion")
113+
self.assertEqual(get_command("shellcompletion")._name, "shellcompletion")
114114

115115
def test_call_command(self):
116116
out = StringIO()

doc/source/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Change Log
55
v1.0.2
66
======
77

8+
* Fixed `name property on TyperCommand is too generic and should be private. <https://github.com/bckohan/django-typer/issues/37>`_
89
* Fixed `When usage errors are thrown the help output should be that of the subcommand invoked not the parent group. <https://github.com/bckohan/django-typer/issues/36>`_
910
* Fixed `typer installs its own system exception hook when commands are run and this may step on the installed rich hook <https://github.com/bckohan/django-typer/issues/35>`_
1011
* Fixed `Add py.typed stub <https://github.com/bckohan/django-typer/issues/31>`_

0 commit comments

Comments
 (0)