Sat, 08 Aug 2015 14:17:30 +0300
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)