tree

package
v0.1.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: BlueOak-1.0.0 Imports: 4 Imported by: 0

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
}

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