Documentation ¶
Overview ¶
Package fliptree renders a tree of nodes as text in reverse: children first, then parent.
For example: given main -> {feat1 -> feat1.1, feat2 -> feat2.1} The tree would look like this:
┌── feat2.1 ┌─┴ feat2 │ ┌── feat1.1 ├─┴ feat1 main
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CycleError ¶
type CycleError struct { // Path from root node to the node that formed the cycle. Path []int }
CycleError is returned when a cycle is detected in the tree.
func (*CycleError) Error ¶
func (e *CycleError) Error() string
type Graph ¶
type Graph struct { // Roots are the nodes at which we want to start rendering the tree. // Each root will be rendered as a separate tree. Roots []string // View returns the text for the node. // The value may be multiline, and may have its own styling. View func(string) string // Edges returns the nodes that are directly reachable // from the given node. Edges func(string) []string }
Graph defines a directed graph.
type Options ¶
type Options struct { Style *Style // If non-nil, this map will be filled with the positions // of each node in the rendered tree. // // The key is the node name, and the value is 0-indexed line number // in the rendered tree where the node appears. Offsets map[string]int }
Options configure the rendering of the tree.
Click to show internal directories.
Click to hide internal directories.