little passthrough to use BaseShell directly

This commit is contained in:
adam j hartz 2016-03-18 11:54:30 -04:00
parent 1e5eab8f5a
commit e928423dbb

View file

@ -88,23 +88,23 @@ class Shell(object):
warn('prompt_toolkit is not available, using readline instead.') warn('prompt_toolkit is not available, using readline instead.')
shell_type = env['SHELL_TYPE'] = 'readline' shell_type = env['SHELL_TYPE'] = 'readline'
# actually make the shell # actually make the shell
if shell_type == 'prompt_toolkit': if shell_type == 'none':
from xonsh.base_shell import BaseShell as cls
elif shell_type == 'prompt_toolkit':
vptk = prompt_toolkit_version() vptk = prompt_toolkit_version()
minor = int(vptk.split('.')[1]) minor = int(vptk.split('.')[1])
if minor < 57 or vptk == '<0.57': # TODO: remove in future if minor < 57 or vptk == '<0.57': # TODO: remove in future
msg = ('prompt-toolkit version < v0.57 and may not work as ' msg = ('prompt-toolkit version < v0.57 and may not work as '
'expected. Please update.') 'expected. Please update.')
warn(msg, RuntimeWarning) warn(msg, RuntimeWarning)
from xonsh.ptk.shell import PromptToolkitShell from xonsh.ptk.shell import PromptToolkitShell as cls
self.shell = PromptToolkitShell(execer=self.execer,
ctx=self.ctx, **kwargs)
elif shell_type == 'readline': elif shell_type == 'readline':
from xonsh.readline_shell import ReadlineShell from xonsh.readline_shell import ReadlineShell as cls
self.shell = ReadlineShell(execer=self.execer,
ctx=self.ctx, **kwargs)
else: else:
raise XonshError('{} is not recognized as a shell type'.format( raise XonshError('{} is not recognized as a shell type'.format(
shell_type)) shell_type))
self.shell = cls(execer=self.execer,
ctx=self.ctx, **kwargs)
# allows history garbace colector to start running # allows history garbace colector to start running
builtins.__xonsh_history__.gc.wait_for_shell = False builtins.__xonsh_history__.gc.wait_for_shell = False