elixir-lang/elixir — pull request #2052 by mururu (2014-02-10 14:14:02+00:00)
Title: Add prompt option for IEx

closes #1946
I am thinking about the API.
What do you think about it? I would be grateful for any feedback. :)
(Maybe I should post to the mailling list?)

## API

The prompt options has two types.

* `:normal` - used when `Node.alive?` returns false
* `:node` - used when `Node.alive?` returns true

The part of the listed in the following of the prompt string is replaced.

* `%counter` - the index of the history
* `%prefix` - a prefix given by `IEx.Server`, for now "iex", "rem" or "pry"
* `%node` - the name of the local node

### Examples

* `prompt: [normal: "%prefix(%counter)>", node: "%prefix(%node)%counter>"]`

this is same with the current prompt

```
iex(1)> :a
:a
iex(2)> :b
:b

iex(name@yuki_ito)1> :a
:a
iex(name@yuki_ito)2> :b
:b
```

* `prompt: [normal: "iex>", node: "iex>"]`

the prompt is always "iex>"

```
iex> :a
:a
iex> :b
:b

iex> :a
:a
iex> :b
:b
```