defmodule IEx.UnicodeIO do
  @moduledoc """
  This module implements the API used by IEX to
  interact with the console. This API may change
  in the future without warnings.
  """

  @doc """
  Implements the get IO API used by IEx. It receives the
  code cache, the instructions counter and needs to
  return a list with the new characters inserted.
  """
  def get(config) do
    prompt = case config.cache do
      [] -> "iex(#{config.counter})> "
      _  -> "...(#{config.counter})> "
    end

    case IO.gets(prompt) do
      { :error, _ } -> ''
      data -> :unicode.characters_to_list(data)
    end
  end

  @doc """
  Implements the put IO API used by IEx. It receives the
  result and prints it.
  """
  def put(result) do
    IO.inspect result
  end

  @doc """
  Implements the error IO API used by IEx. It prints error
  messages.
  """
  def error(result) do
    IO.puts :standard_error, result
  end
end
defmodule IEx.UnicodeIO do
  @moduledoc """
  This module implements the API used by IEX to
  interact with the console. This API may change
  in the future without warnings.
  """

  @doc """
  Implements the get IO API used by IEx. It receives the
  code cache, the instructions counter and needs to
  return a list with the new characters inserted.
  """
  def get(config) do
    prefix = case config.cache do
      [] -> "iex"
      _  -> "..."
    end
    prompt = case node do
      :nonode@nohost ->
        "#{prefix}(#{config.counter})> "
      n ->
        "#{prefix}(#{n})#{config.counter}> "
    end
    case IO.gets(prompt) do
      { :error, _ } -> ''
      data -> :unicode.characters_to_list(data)
    end
  end

  @doc """
  Implements the put IO API used by IEx. It receives the
  result and prints it.
  """
  def put(result) do
    IO.inspect result
  end

  @doc """
  Implements the error IO API used by IEx. It prints error
  messages.
  """
  def error(result) do
    IO.puts :standard_error, result
  end
end

Print node name in IEx prompt
Print node name in IEx prompt

kelvinst/elixir,gfvcastro/elixir,lexmag/elixir,antipax/elixir,michalmuskala/elixir,kelvinst/elixir,pedrosnk/elixir,ggcampinho/elixir,beedub/elixir,joshprice/elixir,ggcampinho/elixir,gfvcastro/elixir,pedrosnk/elixir,elixir-lang/elixir,kimshrier/elixir,beedub/elixir,kimshrier/elixir,antipax/elixir,lexmag/elixir