migration.py
changeset 9740 c0239d8ae742
parent 9294 769b8867f8ce
child 9897 fa44db7da2dc
equal deleted inserted replaced
9737:c6f47e635845 9740:c0239d8ae742
   245                 print repr(obj)
   245                 print repr(obj)
   246         sys.displayhook = do_not_add___to_builtins
   246         sys.displayhook = do_not_add___to_builtins
   247         local_ctx = self._create_context()
   247         local_ctx = self._create_context()
   248         try:
   248         try:
   249             import readline
   249             import readline
   250             from rlcompleter import Completer
   250             from cubicweb.toolsutils import CWShellCompleter
   251         except ImportError:
   251         except ImportError:
   252             # readline not available
   252             # readline not available
   253             pass
   253             pass
   254         else:
   254         else:
   255             readline.set_completer(Completer(local_ctx).complete)
   255             rql_completer = CWShellCompleter(local_ctx)
       
   256             readline.set_completer(rql_completer.complete)
   256             readline.parse_and_bind('tab: complete')
   257             readline.parse_and_bind('tab: complete')
   257             home_key = 'HOME'
   258             home_key = 'HOME'
   258             if sys.platform == 'win32':
   259             if sys.platform == 'win32':
   259                 home_key = 'USERPROFILE'
   260                 home_key = 'USERPROFILE'
   260             histfile = os.path.join(os.environ[home_key], ".cwshell_history")
   261             histfile = os.path.join(os.environ[home_key], ".cwshell_history")