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
1 changed files with 1 additions and 5 deletions

View File

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