MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / get

Method get

cmd2/history.py:188–198  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 #

Callers 15

get_completionsMethod · 0.45
attach_subcommandMethod · 0.45
errorMethod · 0.45
find_editorFunction · 0.45
rich_text_to_stringFunction · 0.45
cmd_wrapperFunction · 0.45
print_helpMethod · 0.45
_choices_to_itemsMethod · 0.45
_complete_argMethod · 0.45
test_history_class_getFunction · 0.45
test_history_max_lengthFunction · 0.45

Calls

no outgoing calls

Tested by 15

test_history_class_getFunction · 0.36
test_history_max_lengthFunction · 0.36
test_indented_textFunction · 0.36
test_indented_tableFunction · 0.36
test_command_synonymsFunction · 0.36
test_ppaged_with_pagerFunction · 0.36