Rename cmd/desc to command/description

Ref #1832
This commit is contained in:
Alexey Sokolov
2022-07-04 23:16:22 +01:00
parent bcfe530fda
commit e0c05ddb63
2 changed files with 9 additions and 6 deletions
+4 -4
View File
@@ -434,9 +434,9 @@ class Module:
# Command stuff
def AddCommand(self, cls, *args, **kwargs):
cmd = cls(*args, **kwargs)
cmd._cmodcommand = CreatePyModCommand(self._cmod, cls.cmd,
cmd._cmodcommand = CreatePyModCommand(self._cmod, cls.command,
COptionalTranslation(cls.args),
COptionalTranslation(cls.desc),
COptionalTranslation(cls.description),
cmd)
return cmd
@@ -685,9 +685,9 @@ class Module:
class Command:
cmd = ''
command = ''
args = ''
desc = ''
description = ''
def __call__(self, sLine):
pass
+5 -2
View File
@@ -310,11 +310,13 @@ TEST_F(ZNCTest, ModpythonCommand) {
class cmdtest(znc.Module):
def OnLoad(self, args, message):
self.AddHelpCommand()
self.AddCommand(testcmd)
return True
class testcmd(znc.Command):
cmd = 'ping'
command = 'ping'
description = cmdtest.t_d('blah')
def __call__(self, line):
self.GetModule().PutModule('pong')
@@ -324,8 +326,9 @@ TEST_F(ZNCTest, ModpythonCommand) {
auto client = LoginClient();
client.Write("znc loadmod modpython");
client.Write("znc loadmod cmdtest");
client.Write("PRIVMSG *cmdtest :help");
client.Write("PRIVMSG *cmdtest :ping");
client.ReadUntil("pong");
client.ReadUntil(":*cmdtest!znc@znc.in PRIVMSG nick :pong");
}
} // namespace