Commit 75a0ea7d authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Add a retrieve method

parent 6df4aa6e
......@@ -71,3 +71,15 @@ class History(object):
def clean(self):
f = open(self.filepath, 'w')
f.close()
def retrieve(self, cmd_id):
"""
:param cmd_id: (int) the id of the command to retrieve
:returns: (str) the stored command record without the id
"""
with open(self.filepath) as f:
for line in f.readlines():
if line.startswith('%s ' % cmd_id):
return line[4:]
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