diff options
Diffstat (limited to 'rpki/cli.py')
-rw-r--r-- | rpki/cli.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/rpki/cli.py b/rpki/cli.py index 2f007101..cbd2b1e1 100644 --- a/rpki/cli.py +++ b/rpki/cli.py @@ -165,7 +165,7 @@ class Cmd(cmd.Cmd): old_completer_delims = readline.get_completer_delims() if self.histfile is not None: try: - readline.read_history_file(self.histfile) + self.read_history() except IOError: pass try: @@ -174,11 +174,29 @@ class Cmd(cmd.Cmd): finally: if self.histfile is not None and readline.get_current_history_length(): try: - readline.write_history_file(self.histfile) + self.save_history() except IOError: pass readline.set_completer_delims(old_completer_delims) + def read_history(self): + """ + Read readline history from file. + + This is a separate method so that subclasses can wrap it when necessary. + """ + + readline.read_history_file(self.histfile) + + def save_history(self): + """ + Save readline history to file. + + This is a separate method so that subclasses can wrap it when necessary. + """ + + readline.write_history_file(self.histfile) + else: cmdloop_with_history = cmd.Cmd.cmdloop |