dch

dch / iex

Last active 6 hours ago

Like 0

Dave's iex script

.iex.exs Raw
1Path.wildcard("/usr/local/lib/erlang/lib/recon-*/ebin") |> hd() |> Code.append_path()
2import_if_available(:recon)
3import_if_available(:recon_trace)
4import_if_available(:observer_cli)
5
6alias Indie.Console
7alias Indie.Repo
8alias Indie.Domains
9alias Indie.Domains.Domain
10alias Indie.Accounts.User
11alias Indie.Commerce.Invoice
12
13alias Cartel.Workers.BuildWorker
14alias Cartel.Workflow
15
16defmodule I do
17 def cls, do: IO.puts("\ec")
18
19 def r, do: recompile(force: true)
20
21 def qt(m, f \\ :_) do
22 l(m)
23
24 :recon_trace.calls(
25 {m, f, :return_trace},
26 {5000, 10000},
27 pid: :all,
28 scope: :local,
29 stack: :return
30 )
31 end
32
33 def raw(any, label \\ "iex") do
34 IO.inspect(any,
35 label: label,
36 pretty: true,
37 limit: :infinity,
38 printable_limit: :infinity,
39 structs: false,
40 syntax_colors: [
41 number: :yellow,
42 atom: :cyan,
43 string: :green,
44 nil: :magenta,
45 boolean: :magenta
46 ],
47 width: 0
48 )
49 end
50
51 def debug(any, label \\ "iex") do
52 IO.inspect(any,
53 label: label,
54 pretty: true,
55 limit: :infinity,
56 printable_limit: :infinity,
57 syntax_colors: [
58 number: :yellow,
59 atom: :cyan,
60 string: :green,
61 nil: :magenta,
62 boolean: :magenta
63 ],
64 width: 0
65 )
66 end
67end
68
69IEx.configure(
70 default_prompt:
71 [
72 # ANSI CHA, move cursor to column 1. Breaks stuff.
73 # "\e[G",
74 :light_green,
75 # plain string
76 "🧪 ",
77 :white,
78 :reset
79 ]
80 |> IO.ANSI.format()
81 |> IO.chardata_to_string(),
82 inspect: [limit: :infinity, pretty: true, printable_limit: :infinity],
83 colors: [
84 enabled: true,
85 syntax_colors: [
86 number: :yellow,
87 atom: :cyan,
88 string: [:italic, :blue],
89 boolean: [:italic, :magenta],
90 nil: [:magenta, :bright]
91 ],
92 ls_directory: :cyan,
93 ls_device: :yellow,
94 doc_code: :green,
95 doc_inline_code: :magenta,
96 doc_headings: [:cyan, :underline],
97 doc_title: [:cyan, :bright, :underline]
98 ]
99)
100
101import I
102