Added ability to define commands into the manifest

Sat, 08 Aug 2015 14:17:30 +0300

author
Teemu Piippo <tsapii@utu.fi>
date
Sat, 08 Aug 2015 14:17:30 +0300
changeset 149
1759c15cd0ca
parent 148
7e225c2659b8
child 150
2fd1f6ee05f5

Added ability to define commands into the manifest

modulecore.py file | annotate | diff | comparison | revisions
--- a/modulecore.py	Sat Aug 08 14:17:06 2015 +0300
+++ b/modulecore.py	Sat Aug 08 14:17:30 2015 +0300
@@ -180,12 +180,16 @@
 def exec_command (commandObject):
 	global g_lastConfirm
 	global g_confirmCommand
-	cmdname = commandObject['cmdname']
 
-	try:
-		func = getattr (commandObject['module'], 'cmd_' + cmdname)
-	except AttributeError:
-		command_error ('''command '%s' does not have a definition''' % cmdname)
+	if 'function' in commandObject:
+		func = commandObject['function']
+	else:
+		cmdname = commandObject['cmdname']
+
+		try:
+			func = getattr (commandObject['module'], 'cmd_' + cmdname)
+		except AttributeError:
+			command_error ('''command '%s' does not have a definition''' % cmdname)
 
 	try:
 		func (**commandObject)

mercurial