View Source IO.ANSI.Table.Spec (IO ANSI Table v1.0.34)

A table spec struct and functions for the IO ANSI Table app.

The table spec struct contains the following fields:

  • initial fields:

    • spec_name,
    • headers,
    • align_specs,
    • bell,
    • count,
    • header_fixes,
    • margins,
    • max_width,
    • sort_specs,
    • sort_symbols,
    • style
  • derived fields:

    • align_attrs,
    • headings,
    • left_margin,
    • sort_attrs
  • data dependent fields:

    • column_widths
    • rows

Summary

Types

t()

A table spec struct for the IO ANSI Table app

Functions

Updates the derived fields of spec.

Creates a table spec struct from headers and options.

Gets the table spec server name in options. Defaults to the current app name expressed as a string.

Writes data from maps to :stdio per table spec and options.

Types

@type t() :: %IO.ANSI.Table.Spec{
  align_attrs: [IO.ANSI.Table.Header.align_attr()],
  align_specs: [IO.ANSI.Table.Header.align_spec()],
  bell: boolean(),
  column_widths: [IO.ANSI.Table.Column.width()],
  count: integer(),
  header_fixes: %{optional(String.t() | Regex.t()) => String.t()},
  headers: [IO.ANSI.Table.Header.t(), ...],
  headings: [String.t()],
  left_margin: String.t(),
  margins: Keyword.t(),
  max_width: pos_integer(),
  rows: [IO.ANSI.Table.Row.t()],
  sort_attrs: [IO.ANSI.Table.Header.sort_attr()],
  sort_specs: [IO.ANSI.Table.Header.sort_spec()],
  sort_symbols: [IO.ANSI.Table.Header.sort_symbol()],
  spec_name: String.t(),
  style: IO.ANSI.Table.Style.t()
}

A table spec struct for the IO ANSI Table app

Functions

@spec develop(t()) :: t()

Updates the derived fields of spec.

Link to this function

new(headers, options \\ [])

View Source
@spec new([IO.ANSI.Table.Header.t(), ...], Keyword.t()) :: t()

Creates a table spec struct from headers and options.

@spec spec_name(Keyword.t()) :: String.t()

Gets the table spec server name in options. Defaults to the current app name expressed as a string.

Examples

iex> alias IO.ANSI.Table.Spec
iex> Spec.spec_name(style: :light, count: 9, spec_name: "github_issues")
"github_issues"

iex> alias IO.ANSI.Table.Spec
iex> Spec.spec_name([])
"io_ansi_table"
Link to this function

write_table(spec, maps, options \\ [])

View Source
@spec write_table(t(), [Access.container()], Keyword.t()) :: :ok

Writes data from maps to :stdio per table spec and options.