Skip to content

Instantly share code, notes, and snippets.

@fertapric
Last active February 9, 2018 23:28
Show Gist options
  • Save fertapric/15e88de17d12558b65be7966fbdf31c0 to your computer and use it in GitHub Desktop.
Save fertapric/15e88de17d12558b65be7966fbdf31c0 to your computer and use it in GitHub Desktop.
Prompt Mix env on IEX (with colors)
env_colors = %{"prod" => ANSI.red(), "dev" => ANSI.green(), "test" => ANSI.green()}
env = System.get_env("MIX_ENV") || "dev"
colored_env = Map.get(env_colors, env, ANSI.yellow()) <> env <> ANSI.reset()
IEx.configure(
default_prompt: "%prefix(#{colored_env},%counter)>",
alive_prompt: "%prefix(#{colored_env},%node,%counter)>"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment