##// END OF EJS Templates
Merge pull request #9273 from takluyver/terminal-magics-aliases...
Min RK -
r22129:a3abc138 merge
parent child Browse files
Show More
@@ -1,6 +1,7 b''
1 """IPython terminal interface using prompt_toolkit in place of readline"""
1 """IPython terminal interface using prompt_toolkit in place of readline"""
2 from __future__ import print_function
2 from __future__ import print_function
3
3
4 import os
4 import sys
5 import sys
5
6
6 from IPython.core.interactiveshell import InteractiveShell
7 from IPython.core.interactiveshell import InteractiveShell
@@ -27,7 +28,7 b' from pygments.lexers import Python3Lexer, PythonLexer'
27 from pygments.token import Token
28 from pygments.token import Token
28
29
29 from .pt_inputhooks import get_inputhook_func
30 from .pt_inputhooks import get_inputhook_func
30 from .interactiveshell import get_default_editor
31 from .interactiveshell import get_default_editor, TerminalMagics
31
32
32
33
33
34
@@ -201,6 +202,23 b' class TerminalInteractiveShell(InteractiveShell):'
201 io.stdout = io.IOStream(sys.stdout)
202 io.stdout = io.IOStream(sys.stdout)
202 io.stderr = io.IOStream(sys.stderr)
203 io.stderr = io.IOStream(sys.stderr)
203
204
205 def init_magics(self):
206 super(TerminalInteractiveShell, self).init_magics()
207 self.register_magics(TerminalMagics)
208
209 def init_alias(self):
210 # The parent class defines aliases that can be safely used with any
211 # frontend.
212 super(TerminalInteractiveShell, self).init_alias()
213
214 # Now define aliases that only make sense on the terminal, because they
215 # need direct access to the console in a way that we can't emulate in
216 # GUI or web frontend
217 if os.name == 'posix':
218 for cmd in ['clear', 'more', 'less', 'man']:
219 self.alias_manager.soft_define_alias(cmd, cmd)
220
221
204 def __init__(self, *args, **kwargs):
222 def __init__(self, *args, **kwargs):
205 super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
223 super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
206 self.init_prompt_toolkit_cli()
224 self.init_prompt_toolkit_cli()
General Comments 0
You need to be logged in to leave comments. Login now