def proceed(cmd): cmd = Cmd(cmd) cmd.removeHead() print 'going to function:', cmd.getCommand() func = globals().get(cmd.getCommand()) if func: return func(cmd.getValues('p')) else: print 'Error: Cannot find command:' + cmd.getCommand() return 'Error: Cannot find command:' + cmd.getCommand()
def give(cmd): module = Cmd(cmd).getCommand() print 'going to module:', module proc = procs.get(module, None) if not proc: print 'no module named \'' + module + '\'' return 'no module named \'' + module + '\'' return proc(cmd)