Trees

Term.Trees.TreeMethod
Tree(
    tree;
    guides::Union{TreeCharSet,Symbol} = :standardtree,
    theme::Theme = TERM_THEME[],
    printkeys::Union{Nothing,Bool} = true,
    print_node_function::Function = print_node,
    print_key_function::Function = print_key,
    title::Union{String, Nothing}=nothing,
    prefix::String = "  ",
    kwargs...,
)

Constructor for Tree

It uses AbstractTrees.print_tree to get a string representation of tree (any object compatible with the AbstractTrees packge). Applies style to the string and creates a renderable Tree.

Arguments:

  • tree: anything compatible with AbstractTree
  • guides: if a symbol, the name of preset tree guides types. Otherwise an instance of AbstractTrees.TreeCharSet
  • theme: Theme used to set tree style.
  • printkeys: If true print keys. If false don't print keys.
  • print_node_function: Function used to print nodes.
  • print_key_function: Function used to print keys.
  • title: Title of the tree.
  • prefix: Prefix to be used in AbstractTrees.print_tree

For other kwargs look at AbstractTrees.print_tree

source
Term.Trees.TreeMethod
Tree(T::DataType)::Tree

Construct a Tree visualization of T's types hierarchy The key is in costructing the actual hierarchy tree recursively.

source
Term.Trees.make_hierarchy_dictMethod
make_hierarchy_dict(x::Vector{DataType}, T::DataType, Tsubs::AbstractDict)::AbstractDict

Recursively create a dictionary with the types hierarchy for T. Tsubs carries information about T's subtypes. The AbstractDict is made backwards. From the deepest levels up.

source
Term.Trees.print_nodeMethod
print_node(io, node)

Core function to enable fancy tree printing. Styles the leaf/key of each node.

source
Term.Trees.style_guidesMethod
style_guides(tree::String, guides::TreeCharSet, theme::Theme)

Apply style to a tree's guides by inserting it into its string representation. Not ideal as it will affect the style of other elements with the same characters like Panels, but ok for no.

source