-
Notifications
You must be signed in to change notification settings - Fork 1
/
iex.exs
69 lines (57 loc) · 1.61 KB
/
iex.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Will be using `ANSI`
Application.put_env(:elixir, :ansi_enabled, true)
# Letting people know what iex.exs they are using
IO.puts(
# IO.ANSI.blink_slow() <>
IO.ANSI.light_blue_background() <>
IO.ANSI.underline() <>
"Using global .iex.exs (located in ~/.iex.exs)" <> IO.ANSI.reset()
)
# Get queue length for the IEx process
# This is fun to see while playing with nodes
queue_length = fn ->
self()
|> Process.info()
|> Keyword.get(:message_queue_len)
end
prefix =
IO.ANSI.light_black_background() <>
IO.ANSI.bright() <>
IO.ANSI.yellow() <>
"%prefix" <>
IO.ANSI.reset()
counter =
IO.ANSI.light_black_background() <>
IO.ANSI.bright() <>
IO.ANSI.yellow() <>
"-%node-(%counter)" <>
IO.ANSI.reset()
info = IO.ANSI.light_blue() <> IO.ANSI.bright() <> "✉ #{queue_length.()}" <> IO.ANSI.reset()
last = IO.ANSI.yellow() <> IO.ANSI.bright() <> "➤" <> IO.ANSI.reset()
alive =
IO.ANSI.bright() <>
IO.ANSI.yellow() <>
IO.ANSI.blink_rapid() <>
"⚡" <>
IO.ANSI.reset()
default_prompt = prefix <> counter <> " | " <> info <> " | " <> last
alive_prompt = prefix <> counter <> " | " <> info <> " | " <> alive <> last
inspect_limit = 5_000
history_size = 100
eval_result = [:green, :bright]
eval_error = [:red, :bright]
eval_info = [:blue, :bright]
# Configuring IEx
IEx.configure(
inspect: [limit: inspect_limit],
history_size: history_size,
colors: [
eval_result: eval_result,
eval_error: eval_error,
eval_info: eval_info
],
default_prompt: default_prompt,
alive_prompt: alive_prompt
)
Logger.remove_backend(:console)
uuid = fn -> Ecto.UUID.generate() end