[erlang-questions] update erlang shell prompt dynamically

wde wde@REDACTED
Fri Aug 3 22:58:38 CEST 2012


Dear Robert,

Thank you for your answer.

Have a great week end.

wde



>There is no trick, it can't be done.
>
>The shell sends off a request to read an erlang expression, this requests contains the prompt. The io-system prints this prompt at the start of every line entered for that input. It is not possible to change the prompt in the middle of a read request.
>
>The reason it is done this is to be able to sensibly handle concurrent io-requests, each request behaves as an atomic transaction.
>
>Robert
>
>----- Original Message -----
>> Hello,
>>
>>
>> I would like to use a custom prompt inside the erlang shell.
>>
>> To do it, I defined the following environment variable for stdlib :
>> {shell_prompt_func,{my_module,my_prompt}}. It works fine !
>>
>> In my prompt definition, I set the number of nodes inside the
>> cluster.  The prompt is updated only when I type something in the
>> shell.
>>
>> ¤ TOTO[titi@REDACTED](cluster_wait)::> blabla().
>> ** exception error: undefined shell command blabla/0
>> ¤ TOTO[titi@REDACTED]:3/3::>
>>
>>
>> How could I refresh the prompt when I push "enter" in the shell ?  I
>> didn't find the trick.
>>
>>
>> Thank you for your help.
>>
>>
>> wde
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>


More information about the erlang-questions mailing list