dirtree

package
v0.0.0-...-7b788e4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	// Parent is kept for debugging and presentation purposes.
	// It should contain the entire filepath leading up to the node.
	Parent string

	Dir string
	// Children maps the part to a Node
	Children map[string]*Node
	Stats    []commit.FileStat
}

func (*Node) AddStat

func (n *Node) AddStat(s commit.FileStat)

AddStat appends the file stat to the node, traversing downwards to the proper child.

func (Node) Name

func (n Node) Name() string

func (*Node) QueryStats

func (n *Node) QueryStats(dir string) []commit.FileStat

QueryStats produces the list of file stats for the path.

func (*Node) Walk

func (n *Node) Walk(depth int, fn func(n *Node, depth int))

Walk traverses the node in a depth-first algorithm.

type Tree

type Tree = Node

func Make

func Make(stats []commit.FileStat) Tree

Make constructs a Tree from a series of stats.

Jump to

Keyboard shortcuts

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