AshTui.Format (AshTui v0.3.1)

Copy Markdown View Source

Shared formatting helpers for display in the TUI.

Summary

Functions

Formats an Ash type for display, stripping common prefixes.

Returns the last segment of a module name.

Functions

format_type(type)

@spec format_type(atom() | {:array, atom()} | term()) :: String.t()

Formats an Ash type for display, stripping common prefixes.

Examples

iex> AshTui.Format.format_type(:string)
"string"

iex> AshTui.Format.format_type({:array, :string})
"[string]"

short_name(module)

@spec short_name(atom()) :: String.t()

Returns the last segment of a module name.

Examples

iex> AshTui.Format.short_name(MyApp.Accounts.User)
"User"

iex> AshTui.Format.short_name(MyApp.Blog)
"Blog"