def preloop(self): ''' Keep persistent command history. ''' if not self.already_prelooped: self.already_prelooped = True open('.psiturk_history', 'a').close() # create file if it doesn't exist readline.read_history_file('.psiturk_history') for i in range(readline.get_current_history_length()): if readline.get_history_item(i) is not None: self.history.append(readline.get_history_item(i))
def get_history_items(): num_items = readline.get_current_history_length() + 1 return [readline.get_history_item(i) for i in range(1, num_items)]
def get_history_items(): num_items = readline.get_current_history_length() + 1 return [ readline.get_history_item(i) for i in range(1, num_items) ]