dirtree

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Standard = TreeFormat{
		Space:    "    ",
		Span:     "│   ",
		Node:     "├── ",
		NodeLast: "└── ",
	}
	Compact = TreeFormat{
		Space:    "  ",
		Span:     "│ ",
		Node:     "├ ",
		NodeLast: "└ ",
	}
)

Functions

func RenderNodes

func RenderNodes(displayNodes []*Node, format TreeFormat, cursor int, renderNode func(*Node) string) string

Types

type Node

type Node struct {
	Path     string
	Name     string
	Expanded bool
	// contains filtered or unexported fields
}

func FlattenTree

func FlattenTree(node *Node, expandAll bool) []*Node

FlattenTree returns []*Node consistent with each node's `Expanded` state

func (*Node) Children

func (node *Node) Children() []*Node

func (*Node) Deselect

func (node *Node) Deselect(recurse bool)

func (*Node) IsDir

func (node *Node) IsDir() bool

func (*Node) IsRoot

func (node *Node) IsRoot() bool

func (*Node) IsSelected

func (node *Node) IsSelected() bool

func (*Node) LoadChildren

func (node *Node) LoadChildren(recurse bool, maxDepth int, visitFunc func(node *Node)) error

func (*Node) Parent

func (node *Node) Parent() *Node

func (*Node) Select

func (node *Node) Select(recurse bool, maxDepth int)

func (*Node) SelectedFiles

func (node *Node) SelectedFiles() []string

SelectedFiles returns the paths of all selected non-directory nodes in the subtree rooted at this node.

func (*Node) SelectedStats

func (node *Node) SelectedStats() (files int, dirs int)

SelectedStats returns the count of selected files and selected directories in the subtree rooted at this node.

type Tree

type Tree struct {
	Root       *Node
	ShowHidden bool
}

func NewTree

func NewTree(path string) *Tree

type TreeFormat

type TreeFormat struct {
	Space    string
	Span     string
	Node     string
	NodeLast string
}

Jump to

Keyboard shortcuts

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