Commit 34e4cf61 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Run ignores self in command listing

parent 2fbca093
#!/usr/bin/env python
# Copyright 2012 GRNET S.A. All rights reserved.
# Copyright 2012-2013 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
......@@ -34,14 +34,6 @@
# or implied, of GRNET S.A.
def order_free_contains(containing, contained):
superset = containing.split()
for term in contained.split():
if term not in superset:
return False
return True
class History(object):
def __init__(self, filepath):
self.filepath = filepath
......@@ -84,7 +76,7 @@ class History(object):
return None
with open(self.filepath) as f:
try:
lala = f.readlines()
return lala[cmd_id - (1 if cmd_id > 0 else 0)]
cmd_list = f.readlines()[:-1] # exclude current command
return cmd_list[cmd_id - (1 if cmd_id > 0 else 0)]
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