def precmd(self, line): """Hook before the command is run If the self.block_command returns True, the command is not run Otherwise, it is run """ line = line.strip() self._step.set_last_user_input(line) if self._step.block_command(line): self._set_command_blocked(True) return Cmd.precmd(self, "") else: self._set_command_blocked(False) return Cmd.precmd(self, line)
def precmd(self, line): '''Hook before the command is run If the self.block_command returns True, the command is not run Otherwise, it is run ''' self.last_user_input = line.strip() if self.block_command(): self.set_command_blocked(True) return Cmd.precmd(self, "") else: self.set_command_blocked(False) return Cmd.precmd(self, line)
def precmd(self, line): '''Hook before the command is run If the self.block_command returns True, the command is not run Otherwise, it is run ''' self.last_user_input = line.strip() if self.block_command(): self.set_command_blocked(True) return Cmd.precmd(self, "") else: self.set_command_blocked(False) return Cmd.precmd(self, line)
def precmd(self, line): if self.color_active: sys.stdout.write("\033[36m") # Cyan color sys.stdout.flush() line = re.sub(r"^(.*[^\\])#.*$", r"\1", line) # strip the '#' comment if not escaped return Cmd.precmd(self, line)
def process_command(processor_cmd: cmd.Cmd, command: str) -> bool: is_stopping: bool if command: command = processor_cmd.precmd(command) is_stopping = processor_cmd.onecmd(command) is_stopping = processor_cmd.postcmd(is_stopping, command) else: is_stopping = True return is_stopping
def precmd(self, line): ''' Process command before ''' # Add command history to file self.command_history.write("%s\n" % line) self.command_history.flush() # Call parent return Cmd.precmd(self, line)
def precmd(self, line): ''' Process command before ''' # Add command history to file self.command_history.write("%s\n" % line) self.command_history.flush() # Call parent return Cmd.precmd(self, line)
def precmd(self, line): current_dir = os.getcwd() # 获取check_tool的目录 result_dir = os.path.join(current_dir, "check_result/") config_dir = os.path.join(current_dir, "check_config/") # 方式exit命令重新打开文件,刷空文件,在输入如下3种命令和空行命令时,可以处理文件 if (line.strip() in ["check all", "check c", "check h", ""]): self.log_f = open(result_dir + "annotation_check_logs.log", "w") self.w_f = open(result_dir + "annotation_check_results.log", "w") self.fail_f = open(result_dir + "annotation_fail_files.log", "w") self.ignore_f = open(config_dir + "ignore_file_list.log", "r") print(" "*15 +"annotation rate threshold:%.2f%%,the following files are the unqualified files" \ %self.rate,file=self.fail_f) print( "---------------------------------------------unqualified files list-------------------------------------------------- ", file=self.fail_f) print("注:若文件头部注释区域无author定义,owner 显示为文件名\n", file=self.fail_f) if (line.strip() == ""): test_cmd_color.printGreen( "the command is empty, will execute the last nonempty command\n\n" ) return Cmd.precmd(self, line)
def precmd(self, line): print("\033[0m", end = '') return Cmd.precmd(self, line)
def precmd(self, line): self._last_command_failed = False return Cmd.precmd(self, line)
def precmd(self, line): self.__stop_completion() return Cmd.precmd(self, line)
def precmd(self, line): if self.color_active: sys.stdout.write("\033[36m") sys.stdout.flush() return Cmd.precmd(self, line)
def precmd(self, line): self._last_command_failed = False return Cmd.precmd(self, line)
def precmd(self, args): if len(self.module) and args == 'help': args = "help "+ self.module[0] return Cmd.precmd(self, args)
def precmd(self, line): print("print this line before do a command") return Cmd.precmd(self, line)
def precmd(self, args): if len(self.module) and args == 'help': args = "help " + self.module[0] return Cmd.precmd(self, args)