Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
75a0ea7d
Commit
75a0ea7d
authored
Dec 11, 2012
by
Stavros Sachtouris
Browse files
Add a retrieve method
parent
6df4aa6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/history.py
View file @
75a0ea7d
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment