scribe v0.9.0 Scribe View Source
Pretty-print tables of structs and maps
Link to this section Summary
Link to this section Types
Link to this type
data()
View Source
data()
View Source
data() :: [] | [...] | term()
data() :: [] | [...] | term()
Link to this type
format_opts() View Source
Options for configuring table output.
:colorize
- Whenfalse
, disables colored output. Defaults totrue
:data
- Defines table headers:style
- Style callback module. Defaults toScribe.Style.Default
:width
- Defines table width. Defaults to:infinite
Link to this section Functions
Link to this function
auto_inspect(inspect?)
View Source
auto_inspect(inspect?)
View Source
auto_inspect(boolean()) :: :ok
auto_inspect(boolean()) :: :ok
Enables/disables auto-inspect override.
If true, Scribe will override inspect/2
for maps and structs, printing
them as tables.
Examples
iex> Scribe.auto_inspect(true)
:ok
Link to this function
auto_inspect?() View Source
Returns true if Scribe is overriding Inspect
.
Examples
iex> Scribe.auto_inspect?
true
Link to this function
console(results, opts \\ []) View Source
Link to this function
format(results, opts \\ []) View Source
Formats data into a printable table string.
Examples
iex> format([])
:ok
iex> format(%{test: 1234}, colorize: false)
"+---------+\n| :test |\n+---------+\n| 1234 |\n+---------+\n"
Link to this function
inspect(results, opts \\ [])
View Source
inspect(results, opts \\ [])
View Source
inspect(term(), format_opts()) :: term()
inspect(term(), format_opts()) :: term()
Prints a table from given data and returns the data.
Useful for inspecting pipe chains.
Examples
iex> Scribe.inspect([])
[]
iex> Scribe.inspect(%{key: :value, test: 1234}, colorize: false)
+----------+---------+
| :key | :test |
+----------+---------+
| :value | 1234 |
+----------+---------+
%{test: 1234, key: :value}
Link to this function
print(results, opts \\ [])
View Source
print(results, opts \\ [])
View Source
print(data(), format_opts()) :: :ok
print(data(), format_opts()) :: :ok
Prints a table from given data.
Examples
iex> print([])
:ok
iex> Scribe.print(%{key: :value, test: 1234}, colorize: false)
+----------+---------+
| :key | :test |
+----------+---------+
| :value | 1234 |
+----------+---------+
:ok