##// END OF EJS Templates
pyproject.toml, setup.py: Declare backend-path (#14313)...
pyproject.toml, setup.py: Declare backend-path (#14313) Replacing `sys.path.insert(0, ".")` in `setup.py` by declaring a custom PEP-517 build system.

File last commit:

r28566:d379f51c
r28603:643c75d0 merge
Show More
cwd_prompt.py
22 lines | 584 B | text/x-python | PythonLexer
Matthias Bussonnier
Add some documentation on how to configure prompts.
r22430 """This is an example that shows how to create new prompts for IPython
"""
from IPython.terminal.prompts import Prompts, Token
import os
class MyPrompt(Prompts):
Matthias Bussonnier
Include reviews from `@tornaria`
r28557 def in_prompt_tokens(self):
Matthias Bussonnier
please linter
r28566 return [(Token, os.getcwd()), (Token.Prompt, ">>>")]
Matthias Bussonnier
Include reviews from `@tornaria`
r28557
Matthias Bussonnier
Add some documentation on how to configure prompts.
r22430
def load_ipython_extension(shell):
new_prompts = MyPrompt(shell)
new_prompts.old_prompts = shell.prompts
shell.prompts = new_prompts
def unload_ipython_extension(shell):
if not hasattr(shell.prompts, 'old_prompts'):
print("cannot unload")
else:
shell.prompts = shell.prompts.old_prompts