def default_cmd_processing(self, cmd, args): """Process any command whose cmd_xxx method does not exist.""" assert cmd == self.curcmdline.split()[0] if misc.any([cmd.startswith(x) for x in self.globaal.illegal_cmds_prefix]): self.console_print('Illegal command in pyclewn.\n') self.prompt() return if cmd == 'set' and args: firstarg = args.split()[0] if misc.any([firstarg.startswith(x) for x in self.globaal.illegal_setargs_prefix]): self.console_print('Illegal argument in pyclewn.\n') self.prompt() return # turn off the frame sign after a run command if misc.any([cmd.startswith(x) for x in self.globaal.run_cmds_prefix]) \ or misc.any([cmd == x for x in ('d', 'r', 'c', 's', 'n', 'u', 'j')]): self.info.update_frame(hide=True) if self.firstcmdline is None: self.firstcmdline = self.curcmdline else: self.clicmd_notify(self.curcmdline, console=False)
def default_cmd_processing(self, cmd, args): """Process any command whose cmd_xxx method does not exist.""" assert cmd == self.curcmdline.split()[0] if misc.any( [cmd.startswith(x) for x in self.globaal.illegal_cmds_prefix]): self.console_print('Illegal command in pyclewn.\n') self.prompt() return if cmd == 'set' and args: firstarg = args.split()[0] if misc.any([ firstarg.startswith(x) for x in self.globaal.illegal_setargs_prefix ]): self.console_print('Illegal argument in pyclewn.\n') self.prompt() return # turn off the frame sign after a run command if misc.any([cmd.startswith(x) for x in self.globaal.run_cmds_prefix]) \ or misc.any([cmd == x for x in ('d', 'r', 'c', 's', 'n', 'u', 'j')]): self.info.update_frame(hide=True) if self.firstcmdline is None: self.firstcmdline = self.curcmdline else: self.clicmd_notify(self.curcmdline, console=False)
def notify(self, cmd): """Notify of the cmd being processed. The OobGdbCommand is run when the trigger_list is empty, or when a prefix of the notified command matches in the trigger_prefix list. """ self.cmd = cmd if not self.trigger_list or misc.any([cmd.startswith(x) for x in self.trigger_prefix]): self.trigger = True
def add(self, command): """Add a command object to the dictionary.""" assert isinstance(command, Command) # do not add an OobGdbCommand if the dictionary contains # an object of the same class if isinstance(command, OobGdbCommand) and misc.any( [command.__class__ is obj.__class__ for obj in self.values()] ): return None t = str(self.token) if t in self: error('token "%s" already exists as an expected pending result', t) self[t] = command self.token = (self.token + 1) % 100 + 100 return t