[IPython-user] Prompt expressions
Walter Dörwald
walter at livinglogic.de
Thu Jun 15 14:20:32 CDT 2006
Ville Vainio wrote:
> On 6/15/06, Ville Vainio <vivainio at gmail.com> wrote:
> [..]
>> I will fix this, but I think I'll do it by exposing the prompt
>> calculation as a hook to expose this functionality in a predictable
>> and simple manner (and thus squat 2 flies at the same time).
>
> Done in SVN (rev 1365), here's an example:
>
> In [1]: pycat myprompt.py
> import os
> from IPython import ipapi
> def prompt_hook(self, cont):
> if cont: return 'cont..'
> return os.getcwd() + " >"
>
> ipapi.get().set_hook('generate_prompt',prompt_hook)
Wow, that was fast!
So how can I generate colored prompts via the hook? What about the
output prompt?
Servus,
Walter
More information about the IPython-user
mailing list