tree

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2026 License: BlueOak-1.0.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

internal/tree/tree.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTree

func FormatTree(root *Node, opts FormatOptions) string

FormatTree returns a string representation of the tree with box-drawing characters.

Types

type FormatOptions

type FormatOptions struct {
	// CurrentBranch is marked with "* " prefix
	CurrentBranch string
	// PRURLFunc returns the URL for a PR number (optional)
	PRURLFunc func(pr int) string
	// Style is used for coloring output (optional, defaults to no color)
	Style *style.Style
}

FormatOptions configures tree formatting.

type Node

type Node struct {
	Name     string
	PR       int // 0 if no PR
	Parent   *Node
	Children []*Node
}

Node represents a branch in the stack tree.

func Build

func Build(cfg *config.Config) (*Node, error)

Build constructs the stack tree from config.

func FindNode

func FindNode(root *Node, name string) *Node

FindNode finds a node by name in the tree.

func GetAncestors

func GetAncestors(node *Node) []*Node

GetAncestors returns all ancestors from node to root (excluding the node itself).

func GetDescendants

func GetDescendants(node *Node) []*Node

GetDescendants returns all descendants of a node (excluding the node itself).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL