Metastatic.CLI.Formatter
(Metastatic v0.10.4)
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
@type format() :: :tree | :json | :plain
@type meta_ast() :: Metastatic.AST.meta_ast()
Functions
Format a MetaAST node for display.
Uses 3-tuple format: {type, meta, children_or_value}
Examples
iex> format({:literal, [subtype: :integer], 42}, :plain)
"literal(integer, 42)"
iex> format({:binary_op, [category: :arithmetic, operator: :+], [{:variable, [], "x"}, {:literal, [subtype: :integer], 5}]}, :tree)
"binary_op (arithmetic: +)\n variable: x\n literal (integer): 5"
@spec format_document(Metastatic.Document.t(), format()) :: String.t()
Format a Document for display.
Includes metadata about language, validation status, etc.