shellify: avoid duplicating history entries

This commit is contained in:
Přemysl Eric Janouch 2016-02-10 23:08:09 +01:00
parent 92247a9fee
commit 4d80701c7e

View File

@ -11,11 +11,7 @@ readline.parse_and_bind ('TAB: complete')
for n in itertools.count (start=1):
try:
line = input ('\x1b[1m%s %d>\x1b[0m ' % (prefix, n))
if line == '':
continue
readline.add_history (line)
os.system (prefix + ' ' + line)
if line != '': os.system (prefix + ' ' + line)
except (EOFError, KeyboardInterrupt) as err:
print ('')
break