Search documentation of Metastatic

# Metastatic.CLI.Formatter (Metastatic v0.2.0)

View Source

Output formatting utilities for Metastatic CLI.

Supports multiple output formats:

- Tree format (default) - Human-readable tree structure
- JSON format - Machine-readable JSON
- Plain format - Simple text representation

# Summary

## Types

format()
meta_ast()

## Functions

format(ast, atom)

Format a MetaAST node for display.

format_document(doc, format)

Format a Document for display.

# Types

# format()

    @type format() :: :tree | :json | :plain

# meta_ast()

    @type meta_ast() :: Metastatic.AST.meta_ast()

# Functions

# format(ast, atom)

    @spec format(meta_ast(), format()) :: String.t()

Format a MetaAST node for display.

## Examples

    iex> format({:literal, :integer, 42}, :plain)
    "literal(integer, 42)"

    iex> format({:binary_op, :arithmetic, :+, {:variable, "x"}, {:literal, :integer, 5}}, :tree)
    "binary_op (arithmetic: +)\n├─ variable: x\n└─ literal (integer): 5"

# format_document(doc, format)

    @spec format_document(Metastatic.Document.t(), format()) :: String.t()

Format a Document for display.

Includes metadata about language, validation status, etc.