mirror of
https://github.com/samba-team/samba.git
synced 2025-08-02 00:22:11 +03:00
samba.netcmd: Reintroduce Command.name.
This commit is contained in:
@ -45,6 +45,14 @@ class Command(object):
|
||||
|
||||
full_description = property(_get_full_description)
|
||||
|
||||
def _get_name(self):
|
||||
name = self.__class__.__name__
|
||||
if name.startswith("cmd_"):
|
||||
return name[4:]
|
||||
return name
|
||||
|
||||
name = property(_get_name)
|
||||
|
||||
# synopsis must be defined in all subclasses in order to provide the
|
||||
# command usage
|
||||
synopsis = None
|
||||
|
@ -56,3 +56,8 @@ class CommandTests(samba.tests.TestCase):
|
||||
class cmd_foo(Command):
|
||||
"""Mydescription"""
|
||||
self.assertEquals("Mydescription", cmd_foo().description)
|
||||
|
||||
def test_name(self):
|
||||
class cmd_foo(Command):
|
||||
pass
|
||||
self.assertEquals("foo", cmd_foo().name)
|
||||
|
Reference in New Issue
Block a user