@@ -114,6 +114,7 @@ def __init__(self):
114
114
'display_header' : False ,
115
115
'display_protected' : False ,
116
116
'indexer_backend' : "as set in config.ini" ,
117
+ 'history_length' : - 1 ,
117
118
'_reopen_tracker' : False ,
118
119
'savepoint_limit' : self ._default_savepoint_setting ,
119
120
'show_retired' : "no" ,
@@ -2087,9 +2088,30 @@ def interactive(self):
2087
2088
"""
2088
2089
print (_ ('Roundup %s ready for input.\n Type "help" for help.' )
2089
2090
% 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
+
2090
2097
try :
2091
2098
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' ])
2092
2113
except ImportError :
2114
+ readline = None
2093
2115
print (_ ('Note: command history and editing not available' ))
2094
2116
2095
2117
while 1 :
@@ -2112,6 +2134,10 @@ def interactive(self):
2112
2134
commit = self .my_input (_ ('There are unsaved changes. Commit them (y/N)? ' ))
2113
2135
if commit and commit [0 ].lower () == 'y' :
2114
2136
self .db .commit ()
2137
+
2138
+ # looks like histfile is saved with mode 600
2139
+ if readline :
2140
+ readline .write_history_file (histfile )
2115
2141
return 0
2116
2142
2117
2143
def main (self ): # noqa: PLR0912, PLR0911
0 commit comments