1"""This is an example that shows how to create new prompts for IPython
2"""
3
4from IPython.terminal.prompts import Prompts, Token
5import os
6
7class MyPrompt(Prompts):
8
9     def in_prompt_tokens(self, cli=None):
10         return [(Token, os.getcwd()),
11                 (Token.Prompt, '>>>')]
12
13def load_ipython_extension(shell):
14    new_prompts = MyPrompt(shell)
15    new_prompts.old_prompts = shell.prompts
16    shell.prompts = new_prompts
17
18def unload_ipython_extension(shell):
19    if not hasattr(shell.prompts, 'old_prompts'):
20        print("cannot unload")
21    else:
22        shell.prompts = shell.prompts.old_prompts
23
24
25
26
27