Set limit on command history length

This commit is contained in:
Jason Croft
2016-02-25 03:50:22 -06:00
parent e171aba8b5
commit e87ee10f8b
+3 -1
View File
@@ -77,13 +77,15 @@ class CLI( Cmd ):
return
cls.readlineInited = True
try:
from readline import read_history_file, write_history_file
from readline import ( read_history_file, write_history_file,
set_history_length )
except ImportError:
pass
else:
history_path = os.path.expanduser( '~/.mininet_history' )
if os.path.isfile( history_path ):
read_history_file( history_path )
set_history_length( 1000 )
atexit.register( lambda: write_history_file( history_path ) )
def run( self ):