Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print node name in IEx prompt #420

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions lib/elixir/lib/iex/unicode_io.ex
Expand Up @@ -11,11 +11,16 @@ defmodule IEx.UnicodeIO do
return a list with the new characters inserted.
"""
def get(config) do
prompt = case config.cache do
[] -> "iex(#{config.counter})> "
_ -> "...(#{config.counter})> "
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)
Expand All @@ -37,4 +42,4 @@ defmodule IEx.UnicodeIO do
def error(result) do
IO.puts :standard_error, result
end
end
end