def setup_readline(self):
        history = self.config.get('cli.history')
        if history:
            # Load history
            history = os.path.expanduser(history)
            try:
                readline.read_history_file(history)
            except __HOLE__:
                pass

            # Save history at exit
            import atexit
            atexit.register(readline.write_history_file, history)

        readline.set_completer(self.complete)
        readline.parse_and_bind('tab: complete')
    
        # We need hyphen in hostnames
        readline.set_completer_delims(readline.get_completer_delims().replace('-', ''))
dataset/ETHPy150Open tehmaze/nagios-cli/nagios_cli/cli.py/CLI.setup_readline