-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_iex.exs
55 lines (50 loc) · 1.06 KB
/
dot_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
import_if_available(Ecto.Query)
import_if_available(Ecto.Changeset)
defmodule :_exit do
defdelegate exit(), to: System, as: :halt
end
import :_exit
defmodule Utils do
def module_compiled?(module) do
function_exported?(module, :__info__, 1)
end
end
defmodule DB do
if Utils.module_compiled?(Ecto.Changeset) do
def update(schema, changes) do
schema
|> Ecto.Changeset.change(changes)
|> Repo.update()
end
end
end
IEx.configure(
colors: [
syntax_colors: [
number: :light_yellow,
atom: :light_cyan,
string: :light_black,
boolean: [:light_blue],
nil: [:magenta, :bright]
],
ls_directory: :cyan,
ls_device: :yellow,
doc_code: :green,
doc_inline_code: :magenta,
doc_headings: [:cyan, :underline],
doc_title: [:cyan, :bright, :underline]
],
default_prompt:
[
# ANSI CHA, move cursor to column 1
"\e[G",
:light_magenta,
# plain string
"🧪 iex",
">",
:white,
:reset
]
|> IO.ANSI.format()
|> IO.chardata_to_string()
)