Created
December 10, 2024 14:10
-
-
Save dch/e458748e2bcfde038f711ca5b3bd1f90 to your computer and use it in GitHub Desktop.
iex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule I do | |
def cls, do: IO.puts("\ec") | |
def qt(m, f \\ :_) do | |
l(m) | |
:recon_trace.calls( | |
{m, f, :return_trace}, | |
{1000, 10000}, | |
pid: :all, | |
scope: :local, | |
stack: :return | |
) | |
end | |
def raw(any, label \\ "iex") do | |
IO.inspect(any, | |
label: label, | |
pretty: true, | |
limit: :infinity, | |
structs: false, | |
syntax_colors: [ | |
number: :yellow, | |
atom: :cyan, | |
string: :green, | |
nil: :magenta, | |
boolean: :magenta | |
], | |
width: 0 | |
) | |
end | |
def debug(any, label \\ "iex") do | |
IO.inspect(any, | |
label: label, | |
pretty: true, | |
limit: :infinity, | |
syntax_colors: [ | |
number: :yellow, | |
atom: :cyan, | |
string: :green, | |
nil: :magenta, | |
boolean: :magenta | |
], | |
width: 0 | |
) | |
end | |
end | |
IEx.configure( | |
default_prompt: | |
[ | |
# ANSI CHA, move cursor to column 1. Breaks stuff. | |
# "\e[G", | |
:light_green, | |
# plain string | |
"🧪 ", | |
:white, | |
:reset | |
] | |
|> IO.ANSI.format() | |
|> IO.chardata_to_string(), | |
inspect: [limit: :infinity, pretty: true], | |
colors: [ | |
enabled: true, | |
syntax_colors: [ | |
number: :yellow, | |
atom: :cyan, | |
string: [:italic, :blue], | |
boolean: [:italic, :magenta], | |
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] | |
] | |
) | |
import_if_available I | |
with home <- System.get_env("HOME"), | |
cwd <- File.cwd!(), | |
true <- cwd != home, | |
iex <- Path.expand(".iex.exs"), | |
true <- File.exists?(iex) do | |
Code.eval_file(iex) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment