Commit 304c90b5 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Check clients.retrieve works

parent 75a0ea7d
......@@ -74,3 +74,12 @@ class history_clean(_init_history):
def main(self):
super(self.__class__, self).main()
self.history.clean()
@command(history_cmds)
class history_recall(_init_history):
"""Re-call a previously called command"""
def main(self, commandid):
super(self.__class__, self).main()
r = self.history.retrieve(commandid)
print(r)
......@@ -78,8 +78,9 @@ class History(object):
:returns: (str) the stored command record without the id
"""
cmd_id = int(cmd_id)
with open(self.filepath) as f:
for line in f.readlines():
if line.startswith('%s ' % cmd_id):
return line[4:]
return None
try:
return f.readlines()[cmd_id - 1]
except IndexError:
return None
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment