Get item from the History list using 1-based indexing. :param index: optional item to get :return: a single [cmd2.history.HistoryItem][]
(self, index: int)
| 186 | self.start_session() |
| 187 | |
| 188 | def get(self, index: int) -> HistoryItem: |
| 189 | """Get item from the History list using 1-based indexing. |
| 190 | |
| 191 | :param index: optional item to get |
| 192 | :return: a single [cmd2.history.HistoryItem][] |
| 193 | """ |
| 194 | if index == 0: |
| 195 | raise IndexError("The first command in history is command 1.") |
| 196 | if index < 0: |
| 197 | return self[index] |
| 198 | return self[index - 1] |
| 199 | |
| 200 | # This regular expression parses input for the span() method. There are five parts: |
| 201 | # |
no outgoing calls