@@ -114,6 +114,7 @@ def __init__(self):
114114 'display_header' : False ,
115115 'display_protected' : False ,
116116 'indexer_backend' : "as set in config.ini" ,
117+ 'history_length' : - 1 ,
117118 '_reopen_tracker' : False ,
118119 'savepoint_limit' : self ._default_savepoint_setting ,
119120 'show_retired' : "no" ,
@@ -2087,9 +2088,30 @@ def interactive(self):
20872088 """
20882089 print (_ ('Roundup %s ready for input.\n Type "help" for help.' )
20892090 % roundup_version )
2091+
2092+ initfile = os .path .join (os .path .expanduser ("~" ),
2093+ ".roundup_admin_rlrc" )
2094+ histfile = os .path .join (os .path .expanduser ("~" ),
2095+ ".roundup_admin_history" )
2096+
20902097 try :
20912098 import readline # noqa: F401
2099+ readline .read_init_file (initfile )
2100+ try :
2101+ readline .read_history_file (histfile )
2102+ except FileNotFoundError :
2103+ # no history file yet
2104+ pass
2105+
2106+ # Default history length is unlimited.
2107+ # Set persistently in readline init file
2108+ # Pragma history_length allows setting on a per
2109+ # invocation basis at startup
2110+ if self .settings ['history_length' ] != - 1 :
2111+ readline .set_history_length (
2112+ self .settings ['history_length' ])
20922113 except ImportError :
2114+ readline = None
20932115 print (_ ('Note: command history and editing not available' ))
20942116
20952117 while 1 :
@@ -2112,6 +2134,10 @@ def interactive(self):
21122134 commit = self .my_input (_ ('There are unsaved changes. Commit them (y/N)? ' ))
21132135 if commit and commit [0 ].lower () == 'y' :
21142136 self .db .commit ()
2137+
2138+ # looks like histfile is saved with mode 600
2139+ if readline :
2140+ readline .write_history_file (histfile )
21152141 return 0
21162142
21172143 def main (self ): # noqa: PLR0912, PLR0911
0 commit comments