Skip to content

Instantly share code, notes, and snippets.

@craigp
Forked from fertapric/.iex.exs
Created August 4, 2017 13:34
Show Gist options
  • Save craigp/3ac43c7f53728b8af0724bdbaf977edc to your computer and use it in GitHub Desktop.
Save craigp/3ac43c7f53728b8af0724bdbaf977edc to your computer and use it in GitHub Desktop.
Prompt Mix env on IEX (with colors)
env = case System.get_env("MIX_ENV") || "dev" do
"prod" -> IO.ANSI.red() <> "prod" <> IO.ANSI.reset()
"dev" -> IO.ANSI.green() <> "dev" <> IO.ANSI.reset()
"test" -> IO.ANSI.green() <> "test" <> IO.ANSI.reset()
mix_env -> IO.ANSI.yellow() <> mix_env <> IO.ANSI.reset()
end
IEx.configure(
default_prompt: "%prefix(#{env},%counter)>",
alive_prompt: "%prefix(#{env},%node,%counter)>"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment