Revision 99085b30 kamaki/cli/history.py
b/kamaki/cli/history.py | ||
---|---|---|
48 | 48 |
return True |
49 | 49 |
|
50 | 50 |
def get(self, match_terms=None, limit=0): |
51 |
f = open(self.filepath, 'r') |
|
52 |
result = ['%s. \t%s' % ( |
|
53 |
i + 1, line) for i, line in enumerate(f.readlines()) |
|
54 |
if self._match(line, match_terms)] |
|
55 |
offset = len(result) - limit if limit and len(result) > limit else 0 |
|
56 |
return result[offset:] |
|
51 |
print 'HER?', self.filepath |
|
52 |
with open(self.filepath, 'r') as f: |
|
53 |
result = ['%s. \t%s' % ( |
|
54 |
i + 1, line) for i, line in enumerate(f.readlines()) |
|
55 |
if self._match(line, match_terms)] |
|
56 |
offset = len(result) - limit if ( |
|
57 |
limit and len(result) > limit) else 0 |
|
58 |
return result[offset:] |
|
57 | 59 |
|
58 | 60 |
def add(self, line): |
59 | 61 |
f = open(self.filepath, 'a+') |
Also available in: Unified diff