(self, entries: list[str], line: str)
| 57 | self.append_to(self.entries, line) |
| 58 | |
| 59 | def append_to(self, entries: list[str], line: str) -> None: |
| 60 | line = line.rstrip("\n") |
| 61 | if line: |
| 62 | if not self.duplicates: |
| 63 | # remove duplicates |
| 64 | try: |
| 65 | while True: |
| 66 | entries.remove(line) |
| 67 | except ValueError: |
| 68 | pass |
| 69 | entries.append(line) |
| 70 | |
| 71 | def first(self) -> str: |
| 72 | """Move back to the beginning of the history.""" |